File tree 2 files changed +2
-2
lines changed
2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ class ArduinoClientMqtt {
90
90
return reject ( new Error ( 'connection failed: you need to provide a valid token' ) ) ;
91
91
}
92
92
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 " ] ;
94
94
const clientID = `${ userid } :${ new Date ( ) . getTime ( ) } ` ;
95
95
const connectionOpts = {
96
96
clientId : clientID ,
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ async function getToken(connectionConfig) {
60
60
rawdata = await request ( accessTokenUri , options ) ;
61
61
data = JSON . parse ( rawdata . body ) ;
62
62
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
64
64
if ( token !== undefined ) {
65
65
return { token : token , expires_in : expires_in } ;
66
66
}
You can’t perform that action at this time.
0 commit comments