File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ class ArduinoClientMqtt {
9090 return reject ( new Error ( 'connection failed: you need to provide a valid token' ) ) ;
9191 }
9292
93- const userid = jws . decode ( options . token ) . payload [ "http://arduino.cc/user_id " ] ;
93+ const userid = jws . decode ( options . token ) . payload [ "http://arduino.cc/id " ] ;
9494 const clientID = `${ userid } :${ new Date ( ) . getTime ( ) } ` ;
9595 const connectionOpts = {
9696 clientId : clientID ,
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ async function getToken(connectionConfig) {
6060 rawdata = await request ( accessTokenUri , options ) ;
6161 data = JSON . parse ( rawdata . body ) ;
6262 var token = data . access_token ;
63- expires_in = data . expires_in ;
63+ expires_in = data . expires_in * 0.8 ; // needed to change the token before it expires
6464 if ( token !== undefined ) {
6565 return { token : token , expires_in : expires_in } ;
6666 }
You can’t perform that action at this time.
0 commit comments