授权服务器osu api不支持授权授予类型

2024-06-06 10:30:29 发布

您现在位置:Python中文网/ 问答频道 /正文

上下文osu api documentation

用户将按下登录按钮,该按钮将引导他们进入授权网站osu auth

然后将被重定向回带有代码的网站

  code = request.query_string

  name_verify = str(code).split('code=')[1]
  #re.search("(?!\w+=)\w+", str(code)) #getting the code
  print(name_verify)

  response = requests.post("https://osu.ppy.sh/oauth/token", data = { 'client_id': xxxx, 'client_secret': "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 'redirect_uri': "https://osu-api-crap.minecreeper0913.repl.co", 'scope':'public', 'code': name_verify, 'grant_type':'authorization_code'}, headers={'Accept': 'application/json', 'Content-Type': 'application/json'})

  print(response.text)

我被告知这是正确的方法,但它总是导致“授权服务器不支持授权授予类型”


Tags: namehttpsclientapijsonapplication网站response
1条回答
网友
1楼 · 发布于 2024-06-06 10:30:29

令牌请求(RFC 6749Section 4.1.3)的内容类型必须是application/x-www-form-urlencoded,尽管令牌响应(RFC 6749Section 4.1.4)的格式是JSON

相关问题 更多 >