添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

MSAL with angular fails to authenticate - fails while attempting to discover the instance

Ask Question

While using SSO to sign on Azure using MSAL with Angular, I get redirected this URL: https://login.microsoftonline.com/common//discovery/instance?api-version=1.1&authorization_endpoint=https://login.microsoftonline.com/{tenant}/{organization}.onmicrosoft.com/{policyName}/oauth2/v2.0/authorize endpoint.

... and the response is - 400 bad request error or an invalid_request (in the xhr)

A curl comes back with this error: "error":"invalid_request","error_description":"AADSTS50050: The request is malformed: invalid format for 'authorization_endpoint'

Why would this happen for new users?

update:

MsalModule.forRoot(
        auth: {
          validateAuthority: false,

setting validateAuthority: false resolved this issue for now. However, setting validateAuthority should not cause problems - this is just a workaround.

If you are using Azure AD, try to change your authorization_endpoint to

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize

Policy name is always used for Azure AD B2C, format like: https://{your-B2C-tenant-name}.b2clogin.com/{organization}.onmicrosoft.com/{policyName}/oauth2/v2.0/authorize.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.