InvalidAuthenticationToken - CompactToken parsing failed with error code: -2147184105

后端 未结 1 1709
执念已碎
执念已碎 2020-12-10 17:23

I am using V1 in order to have a token from Microsoft REST API. (We have Office 365 tenant and I used to successfully get all resources without any problem but not anymore.<

1条回答
  •  鱼传尺愫
    2020-12-10 18:01

    First, the Barer of authorization header is a typo. The correct parameter should be like authorization: bearer {access_token}.

    Second, it seems that you were mixing using the Azure V1.0 endpoint and V2.0 endpoint. If you were developing with V1.0 endpoint which apps were resisted from Azure portals, when we acquire the access token we need to specify the resource parameter instead of scope.

    The scope parameter is used for Azure V2.0 endpoint which apps are resisted from here.

    And the authorization endpoint for Azure AD likes below:

    V1.0:

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

    V2.0:

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

    More detail about the code grant flow with Azure AD, you can refer links below:

    Authorize access to web applications using OAuth 2.0 and Azure Active Directory

    v2.0 Protocols - OAuth 2.0 Authorization Code Flow

    0 讨论(0)
提交回复
热议问题