Merge pull request #1465 from fangzhengjin/alpha
fix: 当OIDC的AuthUrl带有param时,跳转参数拼接错误
This commit is contained in:
@@ -215,14 +215,16 @@ export async function getOAuthState() {
|
|||||||
export async function onOIDCClicked(auth_url, client_id, openInNewTab = false) {
|
export async function onOIDCClicked(auth_url, client_id, openInNewTab = false) {
|
||||||
const state = await getOAuthState();
|
const state = await getOAuthState();
|
||||||
if (!state) return;
|
if (!state) return;
|
||||||
const redirect_uri = `${window.location.origin}/oauth/oidc`;
|
const url = new URL(auth_url);
|
||||||
const response_type = 'code';
|
url.searchParams.set('client_id', client_id);
|
||||||
const scope = 'openid profile email';
|
url.searchParams.set('redirect_uri', `${window.location.origin}/oauth/oidc`);
|
||||||
const url = `${auth_url}?client_id=${client_id}&redirect_uri=${redirect_uri}&response_type=${response_type}&scope=${scope}&state=${state}`;
|
url.searchParams.set('response_type', 'code');
|
||||||
|
url.searchParams.set('scope', 'openid profile email');
|
||||||
|
url.searchParams.set('state', state);
|
||||||
if (openInNewTab) {
|
if (openInNewTab) {
|
||||||
window.open(url);
|
window.open(url.toString(), '_blank');
|
||||||
} else {
|
} else {
|
||||||
window.location.href = url;
|
window.location.href = url.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user