【发布时间】:2020-06-10 06:13:21
【问题描述】:
以下 bash 脚本有效并返回一个令牌。
curl -X POST --user <id>:<key> 'https://<name>.auth.eu-west-1.amazoncognito.com/oauth2/token?grant_type=client_credentials' -H 'Content-Type: application/x-www-form-urlencoded'
我现在想通过 Python 脚本生成一个令牌。我目前正在努力使用 requests 库,但没有成功。下面生成响应 400(错误请求)。
import requests
parameters = {"user":"<id>:<key>", "Content-Type": "application/x-www-form-urlencoded"}
response = requests.get("https://<name>.auth.eu-west-1.amazoncognito.com/oauth2/token?grant_type=client_credentials", params=parameters)
print(response)
【问题讨论】:
标签: python curl oauth-2.0 amazon-cognito access-token