Skip to content

Commit

Permalink
Add DwD example for "header" and "curl" option. (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
eesheesh authored Nov 21, 2022
1 parent 1742d0d commit 2105d6b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ example, the following command uses the PubSub API to list all PubSub topics.
$ curl -H "$(oauth2l header --scope pubsub)" https://pubsub.googleapis.com/v1/projects/my-project-id/topics
```

To send an API request using domain-wide delegation (DwD), for example, to
list `[email protected]`'s Gmail labels:

```bash
$ curl -H "$(oauth2l header --email [email protected] --credentials service_account_credentials.json --scope https://www.googleapis.com/auth/gmail.labels)" https://gmail.googleapis.com/gmail/v1/users/me/labels
```

### curl

This is a shortcut command that fetches an access token for the specified OAuth
Expand All @@ -155,6 +162,14 @@ default). Additional flags after "--" will be treated as curl flags.
$ oauth2l curl --scope cloud-platform,pubsub --url https://pubsub.googleapis.com/v1/projects/my-project-id/topics -- -i
```

To send an API request using domain-wide delegation (DwD), for example, to
list `[email protected]`'s Gmail labels:

```bash
$ oauth2l curl --email [email protected] --credentials service_account_credentials.json --scope https://www.googleapis.com/auth/gmail.labels --url https://gmail.googleapis.com/gmail/v1/users/me/labels
```


### info

Print information about a valid token. This always includes the list of scopes
Expand Down

0 comments on commit 2105d6b

Please sign in to comment.