统一jwt的生成
This commit is contained in:
parent
7343a40472
commit
0ff052e527
@ -34,7 +34,7 @@ class AppleController extends BaseController {
|
||||
if (payload.name) data.nickname = payload.name
|
||||
if (payload.picture) data.avatar = payload.picture
|
||||
let user = await Account.insertOrUpdate({ plat: PlatEnum.APPLE, openId }, data)
|
||||
const ztoken = await res.jwtSign({ id: user.id })
|
||||
const ztoken = await res.jwtSign({ id: user.id, openid: openId, plat: PlatEnum.APPLE })
|
||||
return { token: ztoken }
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ class FacebookController extends BaseController {
|
||||
if (infoRes['name']) user.nickname = infoRes['name']
|
||||
if (infoRes['email']) user.email = infoRes['email']
|
||||
let account = await Account.insertOrUpdate({ plat: PlatEnum.FACEBOOK, openId }, user)
|
||||
const ztoken = await res.jwtSign({ id: account.id })
|
||||
const ztoken = await res.jwtSign({ id: account.id, openid: openId, plat: PlatEnum.FACEBOOK })
|
||||
return { token: ztoken }
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class TiktokController extends BaseController {
|
||||
user.refreshTokenExpire = now + result.data['refresh_expires_in'] - EXPIRE_REDUCE_SECOND
|
||||
user.scope = result.data['scope']
|
||||
let account = await Account.insertOrUpdate({ plat: PlatEnum.TIKTOK, openId }, user)
|
||||
const ztoken = await res.jwtSign({ id: account.id })
|
||||
const ztoken = await res.jwtSign({ id: account.id, openid: openId, plat: PlatEnum.TIKTOK })
|
||||
return { token: ztoken }
|
||||
}
|
||||
@router('post /wallet/tiktok/accesstoken')
|
||||
|
Loading…
x
Reference in New Issue
Block a user