Seth
Seth

Reputation: 49

How to automate O-Auth2 web browser opening to get access token?

So I am working with google sheets API , where I need to authorize the credentials before I can hit api for my account , for that OAuth2 client provides an auth URL which opens in browser and there I have to login in Gmail account and then accept the permissions and then it redirects to a redirect URI and in it's URL there is a code.

But I want to get all this done automatically as this will be part of my backend code , and I want it be automated without me going to browser and logging in . Can this be done using puppeteer ? or anything else ?

Upvotes: 0

Views: 1029

Answers (1)

Iamblichus
Iamblichus

Reputation: 19339

The only option to avoid user interaction is to use a service account with domain-wide delegation. And to use this, you need to be a Workspace domain admin, and you can only act on behalf of users in your Workspace domain.

If you are not a domain admin, there's no way to avoid the workflow you mentioned, with user interaction.

Reference:

Upvotes: 1

Related Questions