@@ -44,24 +44,22 @@ export default class Auth {
4444 }
4545
4646 setSession ( authResult ) {
47- if ( authResult && authResult . accessToken && authResult . idToken ) {
48- // Set the time that the access token will expire at
49- let expiresAt = JSON . stringify (
50- authResult . expiresIn * 1000 + new Date ( ) . getTime ( )
51- ) ;
52- // If there is a value on the `scope` param from the authResult,
53- // use it to set scopes in the session for the user. Otherwise
54- // use the scopes as requested. If no scopes were requested,
55- // set it to nothing
56- const scopes = authResult . scope || this . requestedScopes || '' ;
57-
58- localStorage . setItem ( 'access_token' , authResult . accessToken ) ;
59- localStorage . setItem ( 'id_token' , authResult . idToken ) ;
60- localStorage . setItem ( 'expires_at' , expiresAt ) ;
61- localStorage . setItem ( 'scopes' , JSON . stringify ( scopes ) ) ;
62- // navigate to the home route
63- history . replace ( '/home' ) ;
64- }
47+ // Set the time that the access token will expire at
48+ let expiresAt = JSON . stringify (
49+ authResult . expiresIn * 1000 + new Date ( ) . getTime ( )
50+ ) ;
51+ // If there is a value on the `scope` param from the authResult,
52+ // use it to set scopes in the session for the user. Otherwise
53+ // use the scopes as requested. If no scopes were requested,
54+ // set it to nothing
55+ const scopes = authResult . scope || this . requestedScopes || '' ;
56+
57+ localStorage . setItem ( 'access_token' , authResult . accessToken ) ;
58+ localStorage . setItem ( 'id_token' , authResult . idToken ) ;
59+ localStorage . setItem ( 'expires_at' , expiresAt ) ;
60+ localStorage . setItem ( 'scopes' , JSON . stringify ( scopes ) ) ;
61+ // navigate to the home route
62+ history . replace ( '/home' ) ;
6563 }
6664
6765 getAccessToken ( ) {
0 commit comments