File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -190,8 +190,9 @@ export class GatewayClient {
190190 const storedToken = this . opts . deviceIdentity
191191 ? loadDeviceAuthToken ( { deviceId : this . opts . deviceIdentity . deviceId , role } ) ?. token
192192 : null ;
193- const authToken = storedToken ?? this . opts . token ?? undefined ;
194- const canFallbackToShared = Boolean ( storedToken && this . opts . token ) ;
193+ // Prefer explicitly provided credentials (e.g. CLI `--token`) over any persisted
194+ // device-auth tokens. Persisted tokens are only used when no token is provided.
195+ const authToken = this . opts . token ?? storedToken ?? undefined ;
195196 const auth =
196197 authToken || this . opts . password
197198 ? {
@@ -270,12 +271,6 @@ export class GatewayClient {
270271 this . opts . onHelloOk ?.( helloOk ) ;
271272 } )
272273 . catch ( ( err ) => {
273- if ( canFallbackToShared && this . opts . deviceIdentity ) {
274- clearDeviceAuthToken ( {
275- deviceId : this . opts . deviceIdentity . deviceId ,
276- role,
277- } ) ;
278- }
279274 this . opts . onConnectError ?.( err instanceof Error ? err : new Error ( String ( err ) ) ) ;
280275 const msg = `gateway connect failed: ${ String ( err ) } ` ;
281276 if ( this . opts . mode === GATEWAY_CLIENT_MODES . PROBE ) {
You can’t perform that action at this time.
0 commit comments