优化账号绑定功能及社交解绑
This commit is contained in:
@ -13,19 +13,17 @@ export const generateRandomString = (length: number) => {
|
||||
|
||||
// QQ登录
|
||||
export const handleLoginQQ = () => {
|
||||
const appId = QQ_APP_ID // APP ID
|
||||
const redirectUri = encodeURIComponent('https://tuxixi.net?type=35') // 回调地址
|
||||
const state = generateRandomString(16) // 生成随机state
|
||||
// 存储state用于后续验证
|
||||
localStorage.setItem('qq_login_state', state)
|
||||
window.location.href = `https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=${appId}&redirect_uri=${redirectUri}&state=${state}`
|
||||
window.location.href = `https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=${QQ_APP_ID}&redirect_uri=${redirectUri}&state=${state}`
|
||||
}
|
||||
|
||||
export const handleLoginWechat = () => {
|
||||
const appId = WECHAT_APP_ID // APP ID
|
||||
const redirectUri = encodeURIComponent('https://tuxixi.net?type=32') // 回调地址
|
||||
const state = generateRandomString(16) // 生成随机state
|
||||
// 存储state用于后续验证
|
||||
localStorage.setItem('wechat_login_state', state)
|
||||
window.location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_login&state=${state}`
|
||||
}
|
||||
window.location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=${WECHAT_APP_ID}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_login&state=${state}`
|
||||
}
|
||||
Reference in New Issue
Block a user