我需要创建并返回这样的令牌:
@app.route('/account/login', methods=['POST'])
def login():
if user:
...
return authorization.create_token_response(request={
'client_id': '',
'client_secret': '',
'grant_type': 'password',
'username': '',
'password': ''
})
else:
...
但是我不知道如何构建request
接收到的create token response
对象。你能帮我吗?
Obs:我需要过滤输入数据,我不想使用/oauth/token
,就像您看到的here
答案 0 :(得分:1)
这个用例很奇怪。如果只想生成一个请求对象。您可以使用OAuth2Request
类来创建它,该类位于:
from authlib.specs.rfc6749 import OAuth2Request