【问题标题】:unsupported response type in oauth [duplicate]oauth 中不支持的响应类型 [重复]
【发布时间】:2018-01-17 09:23:18
【问题描述】:

您好,我正在使用 Angular 2 开发 Web 应用程序。我在 webapi 中有 oauth 身份验证。我在前端使用 Angular 2。登录时我在下面的代码中调用。

   private login() {
        this.oauthService.initImplicitFlow();
        this.oauthService.loginUrl = "https://login.microsoftonline.com/d35ba220-6896666-4acc-9899-dc75131c4fba/oauth2/authorize?resource=\"https://graph.windows.net/ \"& response_type=code";
        this.oauthService.redirectUri = "http://localhost:65298";
        this.oauthService.clientId = "<MY_CLIENT_ID>";
        this.oauthService.issuer = "https://login.microsoftonline.com/d35ba220-6749-4acc-578787-dc75131c4fba";
        this.oauthService.oidc = true;
        this.oauthService.setStorage(sessionStorage);
        this.oauthService.tryLogin({});
    }

我遇到了错误。

http://localhost:65298/?error=unsupported_response_type&error_description=AADSTS70005%3a+
The+WS-Federation+sign-in+response+message+contains+an+unsupported+OAuth+parameter+value+in+the+encoded+wctx%3a+%27response_type%27%0d%0aTrace+ID%3a+65dc2592-4ba1-42f6-9f24-eba1c1894900%0d%0aCorrelation+ID%3a+6edaf003-3d26-434b-9b8a-88a267feb350%0d%0aTimestamp%3a+2018-01-17+09%3a09%3a39Z&state=9MnA2eD68aZtOvHSodIjX9IqA1NdSjslrnGaFAlL

有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: .net angular azure oauth azure-active-directory


    【解决方案1】:

    根据AAD Auth Failures - Implicit OAuth is not enabled for the application 上的MSDN 文档,您需要在Azure 门户的App Registration Manifest 中将oauth2AllowImplicitFlow 设置为true

    问题

    在 AAD 中创建应用注册时,您需要手动编辑应用清单并将 oauth2AllowImplicitFlow 属性的值设置为 true。否则 AAD 登录流程将不起作用

    错误“AADSTS70005:应用程序不支持 response_type 'token'...”

    解决方案

    按照以下步骤解决此问题。

    1. 使用租户中的管理员帐户登录 portal.azure.com

    2. 导航到左侧栏中的 Azure Active Directory > 应用注册 > 您的应用

    3. 点击描述您应用的窗格顶部的Manifest

    4. 将属性oauth2AllowImplicitFlow 的值更改为true。如果该属性不存在,请将其添加并将其值设置为true

    5. 点击“保存”保存修改后的清单。

    【讨论】:

    • 我爱你。 ❤ 花了我半天的时间把我的头发拉出来。 Microsoft 是否有关于如何连接到 Dynamics API 的教程,它告诉您如何创建应用程序注册、创建邮递员请求、将授权类型设置为请求中的隐式,并且从未提及此标志。
    • 我正在使用 Angular 8 和 microsoft-adal-angular6,我不得不将 oauth2AllowIdTokenImplicitFlow 设置为 true
    • 您只需选中该框:身份验证 > 访问令牌
    【解决方案2】:

    由于您使用 OAuth2 隐式授权流程来验证您的应用程序,因此您需要将响应类型设置为 id_tokentokenid_token token 而不是 code

    您还需要在 AAD 应用程序的清单文件中将“oauth2AllowImplicitFlow”值设置为 true

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-17
      • 1970-01-01
      • 1970-01-01
      • 2016-12-05
      • 1970-01-01
      • 2019-02-11
      • 1970-01-01
      • 2021-05-09
      相关资源
      最近更新 更多