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

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.

Greg

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.

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

Greg, I had the same issue with Azure AD. I am thinking of same solution of storing access token in storage. In Azure’s case, the access token expires in 1 hour, which means I only need get a new access token after 1 hour. However when it expires and I have to get a new one, the interactive flag has to be set to true even Azure supports “prompt=none”. this way, I will get a new access token. The issue is, as Martin pointed out, the popup will show up very briefly then disappear. This is not a good user experience. I really want to set interactive to false but just could not get it working.

Azure supports the concept of refresh token, but that does not work in my app, which is a Chrome extension ( SPA ).