The difference between interactive an non-interactive modes as staed in the documentation of chrome.identity.getAuthToken() is not so clear to me even after repeated readings.
For a good user experience it is important interactive token requests are initiated by UI in your app explaining what the authorization is for. Failing to do this will cause your users to get authorization requests, or Chrome sign in screens if they are not signed in, with with no context. In particular, do not use getAuthToken interactively when your app is first launched.
and
Fetching a token may require the user to sign-in to Chrome, or approve the application's requested scopes. If the interactive flag is true, getAuthToken will prompt the user as necessary. When the flag is false or omitted, getAuthToken will return failure any time a prompt would be required.
- How to initiate interactive token request by an UI (that explains the reason for authorization) in my app? How will
getAuthToken()understand if it has been invoke from an UI? - "Do not use
getAuthTokeninteractively when your app is first launched" - what is this caution for? - How do interactive & non-interactive modes differ?
- "When the flag is false or omitted,
getAuthTokenwill return failure any time a prompt would be required" - how do I know if a prompt is required or not?