googleapis / googleapis/google-cloud-node
Please add an example of use with Oauth2 Authorisation on behalf of other users.
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
Hello,
it isn't quite clear from the docs that this library supports oAuth2 on behalf of other users (offline use).
The docs only show authentication with json credential file. But that way only works when accessing my own Google services.
It took me a long while and the [help of Stackoverflow ](https://stackoverflow.com/questions/78214862/do-google-cloud-api-libraries-support-oauth2-on-behalf-of-other-users)to figure out that this is how it works with oAuth2 tokens:
`const analyticsAdminClient = new analyticsAdmin.AnalyticsAdminServiceClient(
{ credentials: {
type: 'authorized_user',
client_id: GOOGLE_CLIENT_ID,
client_secret: GOOGLE_CLIENT_SECRET,
refresh_token: refresh_token,
access_token: access_token
}}
);`
Contributor guide
Assessment
This issue has not been assessed yet.