49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
async def vol_redirect(ns={}):
|
|
"""
|
|
验证成功以后 生成授权码code 跳转回填的url+code
|
|
:param ns:
|
|
:return:
|
|
"""
|
|
# redirect_uri = 'https://signin.volcengine.com/oauth/sso/7290551861328035851'
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
auth = ns.get('auth')
|
|
if not auth:
|
|
return {
|
|
'status': False,
|
|
'msg': '当前未登录, status: 1'
|
|
}
|
|
if len(auth) < 5:
|
|
return {
|
|
'status': False,
|
|
'msg': '当前未登录, status: 2'
|
|
}
|
|
|
|
if auth[4] != 'A':
|
|
return {
|
|
'status': False,
|
|
'msg': '当前未登录, status: 3'
|
|
}
|
|
|
|
auth_a = auth[:4] + auth[4 + 1:]
|
|
try:
|
|
res = base64.b64decode(auth_a).decode()
|
|
except Exception as e:
|
|
return {
|
|
'status': False,
|
|
'msg': '当前未登录, status: 4'
|
|
}
|
|
|
|
redirect_uri_li = await sor.R('params', {'pname': 'vol_redirect_url'})
|
|
if not redirect_uri_li:
|
|
return {
|
|
'status': False,
|
|
'msg': '获取跳转链接为空'
|
|
}
|
|
redirect_uri = redirect_uri_li[0]['pvalue']
|
|
|
|
# 如果有user就按照code=user
|
|
return await redirect(redirect_uri + '?code=' + auth)
|
|
|
|
ret = await vol_redirect(params_kw)
|
|
return ret |