File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -97,13 +97,24 @@ export class CredentialStore implements vscode.Disposable {
97
97
} else {
98
98
this . _enterpriseSessionId = session . id ;
99
99
}
100
- const github = await this . createHub ( session . accessToken , authProviderId ) ;
100
+ let github : GitHub | undefined ;
101
+ try {
102
+ github = await this . createHub ( session . accessToken , authProviderId ) ;
103
+ } catch ( e ) {
104
+ if ( ( e . message === 'Bad credentials' ) && ! getAuthSessionOptions . forceNewSession ) {
105
+ getAuthSessionOptions . forceNewSession = true ;
106
+ getAuthSessionOptions . silent = false ;
107
+ return this . initialize ( authProviderId , getAuthSessionOptions ) ;
108
+ }
109
+ }
101
110
if ( authProviderId === AuthProvider . github ) {
102
111
this . _githubAPI = github ;
103
112
} else {
104
113
this . _githubEnterpriseAPI = github ;
105
114
}
106
- await this . setCurrentUser ( github ) ;
115
+ if ( github ) {
116
+ await this . setCurrentUser ( github ) ;
117
+ }
107
118
this . _onDidInitialize . fire ( ) ;
108
119
} else {
109
120
Logger . debug ( `No GitHub${ getGitHubSuffix ( authProviderId ) } token found.` , 'Authentication' ) ;
You can’t perform that action at this time.
0 commit comments