question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authorization is required to perform that action after Google redirect

See original GitHub issue

I’m trying to set up a standalone Apps Script to list and process files from Google Cloud Storage. In trying to following the example from the README, I am unable to get my script to complete the redirect portion of the OAuth2 flow.

I am able to successfully see the Google authorization screen and click the Allow button, but when my browser redirects to the script’s URL with the /usercallback?state= path and query string, I see the following message.

Authorization is required to perform that action.

I’ve dug into the ScriptApp documentation (https://developers.google.com/apps-script/reference/script/script-app#newStateToken()) and actually just tried testing hitting the callback URL without going through an actual authorization from Google and I still see the same issue. It leads me to believe that there is something wrong with the permissions on the Apps Script despite the fact that I am the owner of the script and there’s a single sign-in active on my machine.

I’m curious as to whether this is specifically related to the library, or to my method of using a standalone Apps Script in general.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:36

github_iconTop GitHub Comments

7reactions
erickoledadevrelcommented, Apr 11, 2018

The Apps Script team pushed out a new build that they believe should resolve this issue. Let me know if you see otherwise.

2reactions
prodonjscommented, Mar 24, 2018

I was able to successfully get the example to work!

For me, I had to explicitly set the oauthScopes property in the appsscript.json manifest file to the following:

"oauthScopes": [
    "https://www.googleapis.com/auth/script.external_request",
    "https://www.googleapis.com/auth/userinfo.email"
  ]

Adding those explicitly allowed the redirect function to be called which successfully completed the OAuth authorization.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authorization is required to perform that action after Google ...
In trying to following the example from the README, I am unable to get my script to complete the redirect portion of the...
Read more >
"Authorization is required to perform that action" or ...
for example: When trying to open the script editor from the spreadsheet. You can see in the image that even though the spreadsheet...
Read more >
Using OAuth 2.0 for Web Server Applications | Authorization
Obtaining OAuth 2.0 access tokens · Your application identifies the permissions it needs. · Your application redirects the user to Google along ...
Read more >
The Authorization Response - OAuth 2.0 Simplified
Once the user has finished logging in and approving the request, the authorization server is ready to redirect the user back to the...
Read more >
Implement an OAuth 2.0 server | Cloud-to-cloud | Google Home
Handle authorization requests · Verify that the client_id matches the Client ID you assigned to Google, and that the redirect_uri matches the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found