Don't remove the oauth state on polling the status of the auth request (#663)

* Fix unused ?.

* Don't remove the state from the tokenStore when polling

* changelog
This commit is contained in:
Will Hunt 2023-03-20 17:03:37 +00:00 committed by GitHub
parent e6f51bf2de
commit 7f34d69cfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

1
changelog.d/663.bugfix Normal file
View File

@ -0,0 +1 @@
Fix GitHub OAuth button causing a "Could not find user which authorised this request" error .

View File

@ -190,7 +190,7 @@ export class Webhooks extends EventEmitter {
const oauthUrl = this.config.widgets && new URL("oauth.html", this.config.widgets.parsedPublicUrl);
if (oauthUrl) {
oauthUrl.searchParams.set('service', 'github');
oauthUrl?.searchParams.set('oauth-kind', 'account');
oauthUrl.searchParams.set('oauth-kind', 'account');
}
const { setup_action, state } = req.query;
log.info("Got new oauth request", { state, setup_action });

View File

@ -333,7 +333,7 @@ export class BridgeWidgetApi {
}
// N.B. Service isn't really used.
const stateUserId = this.tokenStore.getUserIdForOAuthState(state);
const stateUserId = this.tokenStore.getUserIdForOAuthState(state, false);
if (!stateUserId || req.userId !== stateUserId) {
// If the state isn't found then either the state has been completed or the key is wrong.