Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add an example of use with Oauth2 Authorisation on behalf of other users. #5168

Open
vritzka opened this issue Mar 24, 2024 · 0 comments

Comments

@vritzka
Copy link

vritzka commented Mar 24, 2024

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 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 }} );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant