feat(OAuth): add 'iss' parameter to OAuth exchange methods for improved provider handling
All checks were successful
Deploy to production / deploy (push) Successful in 1m57s
All checks were successful
Deploy to production / deploy (push) Successful in 1m57s
This commit is contained in:
@@ -361,7 +361,7 @@ export const startOAuthLogin = async ({ providerSlug }) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const exchangeOAuthLogin = async ({ code, state }) => {
|
||||
export const exchangeOAuthLogin = async ({ code, state, iss }) => {
|
||||
if (!code || !state) {
|
||||
throw new Error('oauthcodemissing');
|
||||
}
|
||||
@@ -380,6 +380,9 @@ export const exchangeOAuthLogin = async ({ code, state }) => {
|
||||
const callbackUrl = new URL(stateData.redirectUri);
|
||||
callbackUrl.searchParams.set('code', code);
|
||||
callbackUrl.searchParams.set('state', state);
|
||||
if (iss) {
|
||||
callbackUrl.searchParams.set('iss', iss);
|
||||
}
|
||||
|
||||
const tokens = await oidc.authorizationCodeGrant(configuration, callbackUrl, {
|
||||
pkceCodeVerifier: stateData.codeVerifier,
|
||||
@@ -494,7 +497,7 @@ export const startOAuthLoginForUser = async ({ userId, providerSlug }) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const exchangeOAuthLoginForUser = async ({ userId, code, state }) => {
|
||||
export const exchangeOAuthLoginForUser = async ({ userId, code, state, iss }) => {
|
||||
if (!code || !state) {
|
||||
throw new Error('oauthcodemissing');
|
||||
}
|
||||
@@ -517,6 +520,9 @@ export const exchangeOAuthLoginForUser = async ({ userId, code, state }) => {
|
||||
const callbackUrl = new URL(stateData.redirectUri);
|
||||
callbackUrl.searchParams.set('code', code);
|
||||
callbackUrl.searchParams.set('state', state);
|
||||
if (iss) {
|
||||
callbackUrl.searchParams.set('iss', iss);
|
||||
}
|
||||
|
||||
const tokens = await oidc.authorizationCodeGrant(configuration, callbackUrl, {
|
||||
pkceCodeVerifier: stateData.codeVerifier,
|
||||
|
||||
Reference in New Issue
Block a user