zlZimon
zlZimon

Reputation: 2489

Access not granted or expired with Service Account in Google Apps Script

I am trying to change the signature of a user via a service account and domain wide delegation in a Google Apps Script Webapp. This worked fine with a normal Apps Script. I then changed it to a Webapp and created a GCP Project and linked the Apps Script Project to it.

Now I get the following error Error: Access not granted or expired. at Service_.getAccessToken

For switching the App Script Project to the new one I followed these steps. Then I did this:

The only thing which I can not explain is in the GCP->APIs & Services-> Credentials. Because in addition of a OAuth Client for the service account I just created there is another one called Apps Script which I can not edit.

Upvotes: 0

Views: 1679

Answers (1)

zlZimon
zlZimon

Reputation: 2489

I added the scope https://www.googleapis.com/auth/script.external_request to the appscript.json oauthScopes and redeployed the app.

An authorization popup appeared and after I granted access to it, it worked.

I do not think that the problem was the missing scope but that there was no such authorization step when redeploying after I linked the Webapp to the new GCP project.

Upvotes: 1

Related Questions