-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update README quickstart sample (#173)
- Loading branch information
1 parent
d8c96e3
commit 493a2f0
Showing
2 changed files
with
13 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,29 +55,18 @@ npm install @google-cloud/os-login | |
### Using the client library | ||
|
||
```javascript | ||
if ( | ||
!process.env.GCLOUD_PROJECT || | ||
!process.env.GOOGLE_APPLICATION_CREDENTIALS | ||
) { | ||
throw new Error( | ||
'Usage: GCLOUD_PROJECT=<project_id> GOOGLE_APPLICATION_CREDENTIALS=<path to key json file> node #{$0}' | ||
); | ||
const {OsLoginServiceClient} = require('@google-cloud/os-login'); | ||
const client = new OsLoginServiceClient(); | ||
|
||
async function quickstart() { | ||
const [loginProfile] = await client.getLoginProfile({ | ||
name: 'users/[email protected]', | ||
}); | ||
console.log('Login Profile:'); | ||
console.log(loginProfile); | ||
} | ||
|
||
const oslogin = require('@google-cloud/os-login'); | ||
|
||
const projectId = process.env.GCLOUD_PROJECT; | ||
|
||
const client = new oslogin.OsLoginServiceClient({ | ||
projectId: projectId, | ||
}); | ||
|
||
const request = { | ||
name: 'users/1234abcd', | ||
}; | ||
|
||
const [loginProfile] = await client.getLoginProfile(request); | ||
console.log(loginProfile); | ||
quickstart(); | ||
|
||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters