gpt4 book ai didi

oauth - microsoft_graph oAuth 刷新错误

转载 作者:行者123 更新时间:2023-12-02 01:12:33 27 4
gpt4 key购买 nike

我允许用户使用 oAuth 和 Microsoft Graph API 授权他们的 Microsoft 帐户。我正在使用 this omniauth strategy方便授权。在 OmniAuth 策略中,它包括 authorize_paramstoken_params 的资源“https://graph.microsoft.com”。这让我可以很好地进行身份验证,但是当我去刷新身份验证时,我得到了返回的错误:

{"error"=>"unauthorized_client", "error_description"=>"AADSTS70001: Resource 'https://graph.microsoft.com/' is not supported as resource.\r\n"}

连同 trace_id 和其他一些我会在需要时发布的内容。

我要刷新的端点是 POST https://login.microsoftonline.com/common/oauth2/v2.0/tokenclient_idrefresh_tokengrant_type: "refresh_token" 参数。

就在上周,刷新此 oAuth token 工作正常。 Microsoft Graph API 有什么变化吗?

最佳答案

您可能想看看 Refreshing a Token .

听起来你只是部分地在那里,你只是缺少一些额外的参数:

  • grant_type - 设置为 refresh_token
  • refresh_token - 您从提供商那里收到的刷新 token 值
  • client_id - 这是您上面的应用程序 ID
  • client_secret - 这是我们之前生成的密码
  • scope - 这应该与您第一次请求的同一组范围相匹配
  • redirect_uri - 这是在您的应用程序注册中定义的重定向 URI

这些格式为 application/x-www-form-urlencoded 在您 POST 到 https://login.microsoftonline.com/common/oauth2/v2.0/token

POST URL: https://login.microsoftonline.com/common/oauth2/v2.0/token
POST HEADER: Content-Type: application/x-www-form-urlencoded
POST BODY: grant_type=refresh_token&refresh_token=[REFRESH TOKEN]
&client_id=[APPLICATION ID]&client_secret=[PASSWORD]
&scope=[SCOPE]&redirect_uri=[REDIRECT URI]

关于oauth - microsoft_graph oAuth 刷新错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44461590/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com