Hi,
I have developed an application that shows a WebMap from ArcGIS portal by using the ArcGIS JS API. I implemented authentication flow by using the IdentityManager. I'm able to get the token and register it and the secured resource then loads correctly.
However, when I refresh the page in browser the registered token/credential is not available anymore. Is there a way to keep the sign in status as long as the token is valid? Or is it so that I need to store the access token (and possibly other needed details) my self in client side and then just validate the token before request to JS API and register it again?
What is the recommended way to do this?
Regards,
Eemeli
identityManager.checkSignInStatus( portalUrl + "/sharing" ).then( function ( credential ) {
identityManager.registerToken( {
token: credential.token,
server: portalUrl
} );
resolve( true );
} ).catch( function( error ) {
identityManager.getCredential( portalUrl + "/sharing" ).then( function ( credential ) {
identityManager.registerToken( {
token: credential.token,
server: portalUrl + "/sharing/rest",
expires: credential.expires,
ssl: credential.ssl,
userId: credential.userId
} );
resolve( true );
} );
} );