feat: enhance redirect URL construction with query parameters in authentication flow

This commit is contained in:
wxg0103 2025-08-05 11:04:40 +08:00
parent 27262c9478
commit fcc61f0ab2
3 changed files with 19 additions and 6 deletions

View File

@ -338,7 +338,11 @@ export const iconMap: any = {
},
[
h('path', {
d: 'M512 512a85.333333 85.333333 0 0 1 42.666667 159.232V746.666667a21.333333 21.333333 0 0 1-21.333334 21.333333h-42.666666a21.333333 21.333333 0 0 1-21.333334-21.333333v-75.434667A85.333333 85.333333 0 0 1 512 512z" p-id="16092"></path><path d="M512 85.333333c129.578667 0 234.666667 104.96 234.666667 234.666667V341.333333H896c23.552 0 42.666667 19.2 42.666667 42.666667v512c0 23.466667-19.114667 42.666667-42.666667 42.666667H128c-23.594667 0-42.666667-19.2-42.666667-42.666667V384c0-23.466667 19.072-42.666667 42.666667-42.666667h149.333333v-21.333333C277.333333 190.293333 382.421333 85.333333 512 85.333333zM170.666667 853.333333h682.666666V426.666667H170.666667v426.666666z m341.333333-682.666666a149.290667 149.290667 0 0 0-149.333333 149.333333V341.333333h298.666666v-21.333333C661.333333 237.44 594.474667 170.666667 512 170.666667z',
d: 'M512 512a85.333333 85.333333 0 0 1 42.666667 159.232V746.666667a21.333333 21.333333 0 0 1-21.333334 21.333333h-42.666666a21.333333 21.333333 0 0 1-21.333334-21.333333v-75.434667A85.333333 85.333333 0 0 1 512 512z',
fill: 'currentColor',
}),
h('path', {
d: 'M512 85.333333c129.578667 0 234.666667 104.96 234.666667 234.666667V341.333333H896c23.552 0 42.666667 19.2 42.666667 42.666667v512c0 23.466667-19.114667 42.666667-42.666667 42.666667H128c-23.594667 0-42.666667-19.2-42.666667-42.666667V384c0-23.466667 19.072-42.666667 42.666667-42.666667h149.333333v-21.333333C277.333333 190.293333 382.421333 85.333333 512 85.333333zM170.666667 853.333333h682.666666V426.666667H170.666667v426.666666z m341.333333-682.666666a149.290667 149.290667 0 0 0-149.333333 149.333333V341.333333h298.666666v-21.333333C661.333333 237.44 594.474667 170.666667 512 170.666667z',
fill: 'currentColor',
}),
],

View File

@ -299,7 +299,12 @@ function redirectAuth(authType: string, needMessage: boolean = false) {
}
const config = res.data.config
const redirectUrl = eval(`\`${config.redirectUrl}/${accessToken}\``)
const queryParams = new URLSearchParams(route.query as any).toString()
// redirectUrl
let redirectUrl = `${config.redirectUrl}/${accessToken}`
if (queryParams) {
redirectUrl += `?${queryParams}`
}
let url
if (authType === 'CAS') {
url = config.ldpUri
@ -380,7 +385,6 @@ onBeforeMount(() => {
// modeListlark wecom dingtalk
modeList.value = modeList.value.filter((item) => !['lark', 'wecom', 'dingtalk'].includes(item))
if (QrList.value.length > 0) {
modeList.value = ['QR_CODE', ...modeList.value]
QrList.value.forEach((item) => {
orgOptions.value.push({
key: item,
@ -392,6 +396,11 @@ onBeforeMount(() => {
: t('views.system.authentication.scanTheQRCode.lark'),
})
})
if (modeList.value.length === 0) {
showQrCodeTab.value = true
} else {
modeList.value = ['QR_CODE', ...modeList.value]
}
}
}
})

View File

@ -38,9 +38,9 @@ const initActive = async () => {
agentId: props.config.app_key,
appSecret: props.config.app_secret
}
const redirectUrl = encodeURIComponent(`${window.location.origin}/chat/api/auth/lark?accessToken=${accessToken}`)
//const redirectUrl = encodeURIComponent(`http://127.0.0.1:8080/chat/api/auth/lark?accessToken=${accessToken}`)
const queryParams = new URLSearchParams(route.query as any).toString()
const redirectUrl = encodeURIComponent(`${window.location.origin}/chat/api/auth/lark?accessToken=${accessToken}&${queryParams}`)
//const redirectUrl = encodeURIComponent(`http://127.0.0.1:8080/chat/api/auth/lark?accessToken=${accessToken}&${queryParams}`)
const url = `https://passport.feishu.cn/suite/passport/oauth/authorize?client_id=${data.agentId}&redirect_uri=${redirectUrl}&response_type=code&state=fit2cloud-lark-qr`
const QRLoginObj = window.QRLogin({