|
@@ -7,8 +7,8 @@ import { jwtDecode } from 'jwt-decode'
|
|
|
import MockLogin from '../Login.vue'
|
|
import MockLogin from '../Login.vue'
|
|
|
import { api } from '../../api'
|
|
import { api } from '../../api'
|
|
|
import {
|
|
import {
|
|
|
- clearAuthInfo, clearOAuthTemp, consumeOAuthTransaction,
|
|
|
|
|
- getCachedOAuthState, getCachedVerifier, getOAuthLoginUrl,
|
|
|
|
|
|
|
+ clearOAuthTemp, consumeOAuthTransaction,
|
|
|
|
|
+ getCachedVerifier, getOAuthLoginUrl,
|
|
|
getToken, mockLogin, setAuthInfo
|
|
getToken, mockLogin, setAuthInfo
|
|
|
} from '../../utils/auth'
|
|
} from '../../utils/auth'
|
|
|
const faviconUrl = '/favicon.ico'
|
|
const faviconUrl = '/favicon.ico'
|
|
@@ -151,10 +151,12 @@ onMounted(async () => {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 同时支持 query 和 hash 中的参数(兼容 history 和 hash 路由模式)
|
|
|
const searchParams = new URLSearchParams(location.search)
|
|
const searchParams = new URLSearchParams(location.search)
|
|
|
- const code = searchParams.get('code')
|
|
|
|
|
- const state = searchParams.get('state')
|
|
|
|
|
- const authError = searchParams.get('error')
|
|
|
|
|
|
|
+ const hashParams = new URLSearchParams(location.hash.split('?')[1] || '')
|
|
|
|
|
+ const code = searchParams.get('code') || hashParams.get('code')
|
|
|
|
|
+ const state = searchParams.get('state') || hashParams.get('state')
|
|
|
|
|
+ const authError = searchParams.get('error') || hashParams.get('error')
|
|
|
const noAutoRedirect = sessionStorage.getItem('oauth_no_auto_redirect') === '1'
|
|
const noAutoRedirect = sessionStorage.getItem('oauth_no_auto_redirect') === '1'
|
|
|
|
|
|
|
|
if (code || authError) {
|
|
if (code || authError) {
|