Using browser.identity.getRedirectURL() with Google OAuth

I’m trying to use the URL returned by browser.identity.getRedirectURL() when calling browser.identity.launchWebAuthFlow() to get an access to Google Drive. It does not work because the authorization form tries to redirect the user to the URL returned by browser.identity.getRedirectURL() but gets a server connection timeout error. Does anyone know how to fix this issue?

In theory the launchWebAuthFlow should catch the redirect to that URL so it does not matter that nothing responds on the redirect URL.

Verify that what you have in the oauth config on google is the same as you get from getRedirectURL. Does your manifest have an ID and is it the same that is shown on AMO?

If I open the developer tools when the authorization form is displayed and go to the network tab, I see that a request is sent to the redirect URL. Seems pretty logical to me, that’s the role of the URL. However, I expect it won’t end up with a timeout error.

FYI, the URL is similar to:

I also did a test without the “oauth2” path but that did not work better.

I confirm the URL is the same in the console of Google. If it was not the same, I would get an error earlier (I did the test) and the request to the redirect URL would not be sent. I also have the UUID of the extension in the manifest. I added it in the past to make sure I could test properly the local storage.

It timing out in the dev tools is fine. What should happen is that the popup closes once the flow redirects to this callback URL and the promise for the method resolves with the code or token.

Most flows expect the callback URL to be a subpage, so without /oauth2 would likely not work at all.