ADAL JS - response_type=“token” is not supported

孤者浪人 提交于 2019-11-29 16:29:06

问题


I'm using adal js to auth with Azure AD. I have webApp and webApi. Pretty much my apps follow this sample https://github.com/AzureADSamples/SinglePageApp-WebAPI-AngularJS-DotNet .

I was able to login to my webApp and adal.js successfully acquired a token for my webApi and injected it into a request. All was working until recently. Then token acquisition for webApi stopped working with error:

"response_type 'token' is not supported for the application"

renewToken is failed:AADSTS70005: response_type 'token' is not supported for the application Trace ID: 104c18e3-eb6e-42a4-a292-c6f170f27f65 Correlation ID: c2e65622-0c58-473a-8184-b3056fb1af58 Timestamp: 2015-03-27 22:53:12Z

I can clearly see that adal.js is building a request and puts "response_type=token" into a query string. So, my assumption is that something changed on Azure AD side.

I found one article that correlates response_type=token to implicit grant flow. I confirmed that my webApp has "oauth2AllowImplicitFlow" enabled. I have contacted MS support and waiting for resolution. Meanwhile, I wanted to share this with community and see whether someone has any information regarding the issue.

Thanks


回答1:


If you are building client-side app, you need to enable Implicit flow from the application manifest.

  "oauth2AllowImplicitFlow": true,
  1. Open your application configuration azure portal, and download the manifest file from "Manage Manifest" menu.

  1. search for oauth2AllowImplicitFlow and change the value to true.

  2. upload the file again through the same menu.

Logout and login again to your app and it will work will a charm.


It can also be configured via the Azure AD portal:

  • From the application page, click on Authentication, and under Advanced Settings, select the checkboxes next to Access tokens and ID tokens to enable OAuth2 implicit grant for the application.

more info about OAuth2 Implicit flow >> link:

The implicit grant type is used for mobile apps and web applications (i.e. applications that run in a web browser), where the client secret confidentiality is not guaranteed...




回答2:


recreating my webApp fixed the issue. I'm still investigation the root cause with MS. Manifests for two apps aren't different except their AAD Client IDs.

UPDATE

see my comments for resolution



来源:https://stackoverflow.com/questions/29326918/adal-js-response-type-token-is-not-supported

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!