Skip to content

Commit

Permalink
docs: update README quickstart sample (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and callmehiphop committed Apr 25, 2019
1 parent dd7d2d2 commit e09f788
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
31 changes: 10 additions & 21 deletions packages/google-cloud-oslogin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/beckwith@google.com',
});
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();

```

Expand Down
6 changes: 3 additions & 3 deletions packages/google-cloud-oslogin/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"updateTime": "2019-04-24T18:14:09.570889Z",
"updateTime": "2019-04-25T11:36:51.762325Z",
"sources": [
{
"generator": {
Expand All @@ -12,8 +12,8 @@
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "45199a22a4e47c8d53213d1ac4a5ad7f22382c56",
"internalRef": "244925894"
"sha": "25cbfd4a5386742f5968d69bd276a0436d23bd97",
"internalRef": "245137805"
}
},
{
Expand Down

0 comments on commit e09f788

Please sign in to comment.