0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-31 22:51:25 -05:00

fix(core): update google SSO connector prompt always select-account (#4961)

* fix(core): update google SSO connector prompt always select-account

google SSO connector prompt always select-account

* chore(core): update comment

update comment
This commit is contained in:
simeng-li 2023-11-27 10:56:00 +08:00 committed by GitHub
parent 3f84e724b9
commit 0d636d5607
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -3,7 +3,7 @@ import { type SsoConnector, SsoProviderName } from '@logto/schemas';
import OidcConnector from '../OidcConnector/index.js';
import { type SingleSignOnFactory } from '../index.js';
import { type SingleSignOn } from '../types/index.js';
import { type CreateSingleSignOnSession, type SingleSignOn } from '../types/index.js';
import { basicOidcConnectorConfigGuard } from '../types/oidc.js';
// Google use static issue endpoint.
@ -25,6 +25,14 @@ export class GoogleWorkspaceSsoConnector extends OidcConnector implements Single
});
}
// Always use select_account prompt for Google Workspace SSO.
override async getAuthorizationUrl(
payload: { state: string; redirectUri: string; connectorId: string },
setSession: CreateSingleSignOnSession
) {
return super.getAuthorizationUrl(payload, setSession, 'select_account');
}
async getConfig() {
return this.getOidcConfig();
}

View file

@ -54,7 +54,8 @@ class OidcConnector {
redirectUri,
connectorId,
}: { state: string; redirectUri: string; connectorId: string },
setSession: CreateSingleSignOnSession
setSession: CreateSingleSignOnSession,
prompt?: 'login' | 'consent' | 'none' | 'select_account'
) {
assert(
setSession,
@ -76,6 +77,7 @@ class OidcConnector {
responseType: 'code',
redirectUri,
}),
...conditional(prompt && { prompt }),
scope: oidcConfig.scope,
});