【问题标题】:Error "invalid_client" when trying to get a token from Microsoft API尝试从 Microsoft API 获取令牌时出现错误“invalid_client”
【发布时间】:2021-04-23 09:07:15
【问题描述】:

我正在尝试在windev程序中开发驱动解决方案(Onedrive)。

我在 Microsoft Azure 中创建了一个应用程序并创建了一个密钥。

在执行第一个请求时 https://login.live.com/oauth20_authorize.srf?client_id={client_id}&scope={scope} &response_type=code&redirect_uri={redirect_uri} 我在连接页面上被重定向。

连接后,我会收到一个https://login.live.com/oauth20_authorize.srf?code={code}. 的代码

但是当我要求一个令牌发布这个请求时:POST https://login.live.com/oauth20_token.srf Content-Type: application/x-www-form-urlencoded client_id={client_id}&redirect_uri={redirect_uri}&client_secret={client_secret} &code={code}&grant_type=authorization_code

我拿回来了

{ "error":"invalid_client", "error_description":"The client does not exist or is not enabled for consumers. If you are the application developer, configure a new application through the App Registrations in the Azure Portal at https:\/\/go.microsoft.com\/fwlink\/?linkid=2083908.", "correlation_id":"471e800c-69b4-43c6-a03f-a1f7e9512e6b" }

感谢您的帮助。

【问题讨论】:

    标签: azure-active-directory microsoft-graph-api onedrive windev


    【解决方案1】:

    此错误表示您正在使用 Microsoft 帐户登录您的客户端应用程序,但未启用该帐户。

    要更改现有 AD 应用程序的设置,请导航到门户中的 Manifest 刀片,找到 signInAudience 属性,将其设置为 AzureADandPersonalMicrosoftAccountPersonalMicrosoftAccount

    【讨论】:

    • 感谢您的回答。我试过了,但是当我更改该属性时,我无法保存清单。我收到这条消息:Échec de la mise à jour de l'application BeeImmo。细节 de l'erreur : Le schéma d'URI est non valide ou non pris en charge。 [QGW5pi3Jc5avTk0rwGHXi+] 英文应该是:The URI scheme is not valid or not supported。
    • @Kazh 你是否更改了清单的其他配置?
    • 一点也不。我将为您发布带有隐藏 ID 的清单。
    • @Kazh 另一种方法是在创建应用程序时选择此选项i.stack.imgur.com/IeFdM.png
    • @Kazh 我想这可能是回复网址的原因。你可以把manifest信息提供给我,让我看看。
    猜你喜欢
    • 2022-06-23
    • 2019-11-13
    • 1970-01-01
    • 2011-10-25
    • 2018-11-03
    • 2021-11-04
    • 2015-12-08
    • 1970-01-01
    • 2016-07-26
    相关资源
    最近更新 更多