refactor(oidc): simplify callback statement

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2024-10-09 00:36:52 +02:00 committed by Philip Molares
parent f71bf7a974
commit e7d81c5cdf

View file

@ -187,13 +187,10 @@ export class OidcService {
const code = request.session.oidcLoginCode;
const state = request.session.oidcLoginState;
const isAutodiscovered = clientConfig.config.authorizeUrl === undefined;
const tokenSet = isAutodiscovered
? await client.callback(clientConfig.redirectUri, params, {
// eslint-disable-next-line @typescript-eslint/naming-convention
code_verifier: code,
state,
})
: await client.oauthCallback(clientConfig.redirectUri, params, {
const callbackMethod = isAutodiscovered
? client.callback.bind(this)
: client.oauthCallback.bind(this);
const tokenSet = await callbackMethod(clientConfig.redirectUri, params, {
// eslint-disable-next-line @typescript-eslint/naming-convention
code_verifier: code,
state,