@@ -137,18 +137,23 @@ export default class Authentication {
137137 ) ;
138138 } else {
139139 // Skip refreshTokens within 23 hours
140+ console . log ( 'Skip refreshTokens within 23 hours' )
140141 if (
141142 Date . now ( ) - this . _tokenStore . getTokenUpdateTime ( ) <
142143 23 * 60 * 60 * 1000
143144 ) {
144145 console . log ( '[startSilentFlow] skip refreshTokens - branch1' ) ;
145146
146147 // Get new streaming token
147- this . _xal
148- . getStreamingToken ( this . _tokenStore )
148+ this . getStreamingToken ( this . _tokenStore )
149149 . then ( streamingTokens => {
150150 // console.log('streamingTokens:', JSON.stringify(streamingTokens));
151151 this . _xal . getWebToken ( this . _tokenStore ) . then ( webToken => {
152+ if ( streamingTokens . xCloudToken !== null ) {
153+ this . _appLevel = 2 ;
154+ } else {
155+ this . _appLevel = 1 ;
156+ }
152157 saveStreamToken ( streamingTokens ) ;
153158 saveWebToken ( webToken ) ;
154159 this . _application . authenticationCompleted ( streamingTokens , webToken ) ;
@@ -161,8 +166,7 @@ export default class Authentication {
161166 console . log (
162167 '[startSilentFlow()] Tokens have been refreshed - branch1' ,
163168 ) ;
164- this . _xal
165- . getStreamingToken ( this . _tokenStore )
169+ this . getStreamingToken ( this . _tokenStore )
166170 . then ( streamingTokens => {
167171 // log.info('streamingTokens:', streamingTokens);
168172 this . _xal . getWebToken ( this . _tokenStore ) . then ( webToken => {
@@ -405,7 +409,6 @@ export default class Authentication {
405409 }
406410
407411 async getStreamingToken ( tokenStore : TokenStore ) {
408- console . log ( "getStreamingToken" ) ;
409412 const sisuToken = tokenStore . getSisuToken ( ) ;
410413 if ( sisuToken === undefined )
411414 throw new Error ( "Sisu token is missing. Please authenticate first" ) ;
0 commit comments