oauth中不支持的响应类型[重复]

问题描述 投票:2回答:2

嗨,我正在开发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
2个回答
4
投票

查看本文如何在Azure门户上的AAD应用程序注册清单文件中设置“oauth2AllowImplicitFlow”。

https://msdn.microsoft.com/en-us/skype/websdk/docs/troubleshooting/auth/aadauth-enableimplicitoauth

摘要

问题

在AAD中创建应用程序注册时,您需要手动编辑应用程序清单并将oauth2AllowImplicitFlow属性的值设置为true。否则,AAD登录流程将无效 - 错误“AADSTS70005:response_type'令牌'不支持该应用程序...”

解决方案

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

  1. 使用您租户中的管理员帐户登录portal.azure.com。
  2. 导航到左侧栏中的Azure Active Directory>应用程序注册>您的应用程序。
  3. 单击描述应用程序的窗格顶部的Manifest。
  4. 将属性oauth2AllowImplicitFlow的值更改为true。如果该属性不存在,请添加它并将其值设置为true
  5. 单击“保存”以保存修改后的清单。

enter image description here


2
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.