fix(oidc): add PKCE support for keycloak login flow

This commit is contained in:
Chris
2026-04-01 01:43:53 +08:00
parent e3e920dc64
commit cbf2a19b1b
3 changed files with 38 additions and 5 deletions

View File

@@ -6,9 +6,15 @@ export const getOidcAuthorizeUrl = (redirectUri, options = {}) =>
redirect_uri: redirectUri,
login_hint: options.loginHint || undefined,
prompt: options.prompt || undefined,
idp_hint: options.idpHint || undefined
idp_hint: options.idpHint || undefined,
code_challenge: options.codeChallenge || undefined,
code_challenge_method: options.codeChallengeMethod || undefined
}
})
export const exchangeOidcCode = (code, redirectUri) =>
userHttp.post('/auth/oidc/exchange', { code, redirect_uri: redirectUri })
export const exchangeOidcCode = (code, redirectUri, codeVerifier) =>
userHttp.post('/auth/oidc/exchange', {
code,
redirect_uri: redirectUri,
code_verifier: codeVerifier || undefined
})