I have setup user login for my angular app using this link Auth0 Angular SDK Quickstarts: Login and everything seems to work fine, apart from a couple of questions I have.
Every time the browser is refreshed, it goes to re-authenticate which I expect as now the storage for the local tokens has been moved from localStorage to local variables in my app, so they would be lost if the browser refreshes. However as I am using Google Chrome browser (on Windows), and as I am logged into my two google accounts in the browser, every time the page reloads, I am asked which account I want to login with.
I would prefer that if I have recently logged in with account X, that it would automatically choose account X, BUT if I logout of my app, that next time it would ask me to choose the account I want.
Is this current behaviour working as expected (i.e. have I implemented it correctly) and is the desired behavour I have outlined possible?
I have looked at the different options for âpromptâ but if I specify none and I am do not have an authenticated session with Auth0, then it fails, in this case should I catch this error and then do a ânormalâ login? But I donât want to change the recommended auth0 code used in the example unless this is correct.
One more question: in Google Chrome on Android, even if I have e.g. 4 tabs open, and if I leave it overnight (I have token renewal every hour enabled) and go back to the browser, itâs still logged in (which is what I want for now) and I can perform actions without having to login - so does this mean even in Chrome on Android when phone is sitting idle itâs performing the refresh of token every hour? I wasnât sure if Android allowed this background activity in Chrome - great if it does.
And a final question - I have noticed that after the hour (or 55 mins as I have set it to), when browser does silent renewal of token, I seem to get about 10 requests at the same time for this - if anyone knows why this may occur please let me know.
If I can provide any more information to make this easier to answer please let me know. Thanks.
Just to add, below is some snippets where I have made small changes to the code:
public login(): void {
this.auth0.authorize(
{
connection: 'google-oauth2',
connectionScope: 'https://www.googleapis.com/auth/calendar.events.readonly',
accessType: 'offline'
} as any);
}
this.auth0.checkSession({
connection: 'google-oauth2',
connectionScope: 'https://www.googleapis.com/auth/calendar.events.readonly',
accessType: 'offline'
} as any, (err, authResult) => {