Google Apps Script: Endpoint Not Found -


There is a problem running as a web app in my Google Docs add-on where users have several Log in to Google accounts at the same time, and then when they try to authorize with a third party application, their access token is saving to the wrong Google account.

To bring this around, I think that by passing the user's email in a state parameter to an authorized user's email and then adding an authuser parameter to the correct user's email Regenerate redirect URL. And then redirect to that endpoint. However, I'm having trouble creating a new redirect URL that actually works.

My regular OAuth directory brings me back to my script at the end point / exec> inside of me doGet () I see that the state parameter Value is equal to session .getActiveUser (). GetEmail () . If it does not happen then I do not create a new redirection url on my / exec endpoint, except I add an authuser parameter with a redirection parameter that will make that app a new one To try and create the redirect, it asks you to do the next time via doGet () . After that, I output to an HTML page which is called UserAuth. The UserAuth page contains a link for the user that clicks on using new redirects containing Euuthius. The problem is, when you click on this link, "Sorry, the file you have requested does not exist." Error message.

What is happening to my / exec endpoint which tries to request it a second time? Should I go better in this regard?

Update: I found that my / exec endpoint could not be found only when I entered a authuser parameter value Send me what is currently authorized with Google, do I have a misunderstanding of the authoruth parameter? I thought that since both users were signed in to Google Accounts, authuser would specify which account was using the add-on.

My doGet () code is down thanks to any help!

  function doGet (request) {var HTMLToOutput; If (request.parameters.state! = Session.getActivusUser (). GetEmail () and; request.parameters.redir) {var authuser = request.parameters.state; Var newREDR = AUTH_REDIRECT_URI; NewRedir = newRedir + "? Code =" + request.parameters.code + "& redir = true & amp; authuser =" + authuser; SetPrivateCache ('newRedir', newRedir); HTMLToOutput = HtmlService.createHtmlOutputFromFile ("userAuth"); } Else if (request.parameters.code) {HTMLToOutput = upgradeAuthCode (request.parameters.code + ""); } Else if (request.parameters.error == 'access_denied') {HTMLToOutput = HtmlService.createHtmlOutputFromFile ("accessed"); } Return HTMLToOutput; }  

Ah, it was she. Thanks, Eric! I had to develop and run a script from a test domain which only allowed access to the web app from within the domain. The other account I was using to test was from Gmail.

For this reason I did not think of a Gmail account that did not start at the beginning of the web app because I successfully hit / exec endpoint and it was shown as UserAuth HTML page But when I hit the link to go back to / exec , I was shown 404.

In the last time, this is obvious, because for the first time I was with / Exec the first account that had access to the web app. The second time I hit / exec , then with the other account that did not have access to the web app.

Once the Apps Apps have gone out of the trial domain and the Web app was deployed to allow anyone to access, the redirect works correctly.


Comments