browser.identity.launchWebAuthFlow() always needs to be interactive

(Greg Kochaniak) #1

I’m authorizing to Google Drive with a call to browser.identity.launchWebAuthFlow(). It works fine, except that the ‘interactive’ parameter must be always true. No matter how many times I authorized in the extension with my Google account, it won’t work at all without the ‘interactive’ parameter, or with it set to false. What could be done to avoid interactive authorization over and over? The launchWebAuthFlow() is called from a background script. The error message I receive with interactive set to false (or not present) is always:

Rejected, reason: Error: Requires user interaction

Please help.


(Martin Giger) #2

Typically the way for it to not be interactive if the flow requires user interaction is to get a refresh token or similar from the authorizer that you can use to get a new token without user interaction.

If there is no need for user interaction in the “interactive” flow it should just be a popup that barely shows up.

(Greg Kochaniak) #3

Thank you for your help, Martin! I now solved the problem by using the auth token obtained in interactive session using set() and get() functions, and only calling the interactive process if the token is found to be invalid or other error occurs.