googleworkspace / apps-script-oauth2

An OAuth2 library for Google Apps Script.
https://developers.google.com/apps-script/
Apache License 2.0
1.56k stars 429 forks source link

GDS Connector w/ OAuth2 intermittently responding with 'invalid_grant' #421

Closed jmasom closed 1 year ago

jmasom commented 1 year ago

So I have a GDS connector project that uses this library (updated the version today to the most recent). I'm relying on the 3-legged workflow just for some context. For some reason, and quite unpredictably, the auth flow sometimes encounters an 'invalid_grant' response, which most likely means that the authorization code somehow does not exist or has already been consumed, but I don't know what might cause that. Have any other Apps Script developers encountered this to your knowledge, and what are some steps I might take to counteract this? Could the Service object be using up the code somewhere I'm not seeing?

jmasom commented 1 year ago

I discovered the problem was that I was using deployments as separate environments which was causing some code/variables to be shared or overwritten across environments. Not an OAuth issue