Skip to content

Commit da5013d

Browse files
yoshi-automationcallmehiphop
authored andcommitted
docs: update README quickstart sample (#173)
1 parent acc1a48 commit da5013d

File tree

2 files changed

+13
-24
lines changed

2 files changed

+13
-24
lines changed

packages/google-cloud-oslogin/README.md

+10-21
Original file line numberDiff line numberDiff line change
@@ -55,29 +55,18 @@ npm install @google-cloud/os-login
5555
### Using the client library
5656

5757
```javascript
58-
if (
59-
!process.env.GCLOUD_PROJECT ||
60-
!process.env.GOOGLE_APPLICATION_CREDENTIALS
61-
) {
62-
throw new Error(
63-
'Usage: GCLOUD_PROJECT=<project_id> GOOGLE_APPLICATION_CREDENTIALS=<path to key json file> node #{$0}'
64-
);
58+
const {OsLoginServiceClient} = require('@google-cloud/os-login');
59+
const client = new OsLoginServiceClient();
60+
61+
async function quickstart() {
62+
const [loginProfile] = await client.getLoginProfile({
63+
name: 'users/[email protected]',
64+
});
65+
console.log('Login Profile:');
66+
console.log(loginProfile);
6567
}
6668

67-
const oslogin = require('@google-cloud/os-login');
68-
69-
const projectId = process.env.GCLOUD_PROJECT;
70-
71-
const client = new oslogin.OsLoginServiceClient({
72-
projectId: projectId,
73-
});
74-
75-
const request = {
76-
name: 'users/1234abcd',
77-
};
78-
79-
const [loginProfile] = await client.getLoginProfile(request);
80-
console.log(loginProfile);
69+
quickstart();
8170

8271
```
8372

packages/google-cloud-oslogin/synth.metadata

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"updateTime": "2019-04-24T18:14:09.570889Z",
2+
"updateTime": "2019-04-25T11:36:51.762325Z",
33
"sources": [
44
{
55
"generator": {
@@ -12,8 +12,8 @@
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "45199a22a4e47c8d53213d1ac4a5ad7f22382c56",
16-
"internalRef": "244925894"
15+
"sha": "25cbfd4a5386742f5968d69bd276a0436d23bd97",
16+
"internalRef": "245137805"
1717
}
1818
},
1919
{

0 commit comments

Comments
 (0)