oauth中不支持的响应类型 [英] unsupported response type in oauth
问题描述
我正在Angular 2中开发Web应用程序.我在webapi中具有oauth身份验证.我在前端使用Angular 2.登录时,我正在调用以下代码.
Hi I am developing web application in Angular 2. I have oauth authentication in webapi. I am using Angular 2 in front end. On login I am calling below code.
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
有人可以帮我解决这个问题吗?
Can someone help me to fix this?
推荐答案
According to the MSDN Documentation on AAD Auth Failures - Implicit OAuth is not enabled for the application, you need to set oauth2AllowImplicitFlow
to true
in the App Registration Manifest in the Azure Portal.
在AAD中创建应用程序注册时,需要手动编辑应用程序清单并将oauth2AllowImplicitFlow
属性的值设置为true
.否则,AAD登录流程将无法正常工作
When creating your app registration in AAD, you need to manually edit the application manifest and set the value of the oauth2AllowImplicitFlow
property to true
. Otherwise the AAD sign in flow will not work
错误"AADSTS70005:应用程序不支持response_type'token'..."
error "AADSTS70005: response_type 'token' is not supported for the application..."
解决方案
请按照以下步骤解决此问题.
The Solution
Follow these steps to solve this issue.
-
使用租户中的管理员帐户登录 portal.azure.com .
导航到左侧栏中的 Azure Active Directory . 应用注册> 您的应用.
Navigate to Azure Active Directory in the left hand side bar > App registrations > Your app.
点击描述您的应用的窗格顶部的清单.
Click Manifest at the top of the pane describing your app.
将属性oauth2AllowImplicitFlow
的值更改为true
.如果该属性不存在,请将其添加并将其值设置为true
.
Change the value of the property oauth2AllowImplicitFlow
to true
. If the property is not present, add it and set its value to true
.
点击保存"保存修改后的清单.
Click "Save" to save the modified manifest.
这篇关于oauth中不支持的响应类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!