Not able to access web api hosted in Azure enviornment

Agrawal C, Akash 46 Reputation points
2021-07-16T16:30:55.78+00:00

Hi Team,
There is an api hosted in azure enviornment and i am trying to access the same. Although to access the same i need to pass the access token.
To get the access token i have added api permission in my application eso. Also from mobile i am passing scopes as well but its not working and i am getting error while loggin itself.

below is stacktrace. scope and client id is dummy to keep confidentiality.

com.microsoft.identity.client.AuthenticationResultAdapter:declinedScopeExceptionFromRes [2021-07-16 16:17:23 - thread_name : main, correlation_id : UNSET] Returning DeclinedScopeException as not all requested scopes are granted, Requested scopes: [user.read, api://546ddd-6bddd-4ccd-87ff-543a4ceeqc7b1/sample_webapi_scope] Granted scopes:[email, openid, profile, User.Read] Android 30

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
23,198 questions
{count} votes

Accepted answer
  1. AmanpreetSingh-MSFT 56,751 Reputation points
    2021-07-20T05:03:58.713+00:00

    Hi @Agrawal C, Akash · Thank you for reaching out.

    Looking at the error, I suspect that the scopes you have added under the API permissions blade of the client application, does not contain all the required scopes to authorize the client to access the web api. Make sure below steps are done under Azure AD:

    1. App Registration > Select the application registered as Web API > Expose as API > Add required scopes.
    2. App Registration > Select the application registered as Client/Native App > API Permissions > Add all the scopes added in above step > Click on Grant Admin consent.

    If you still encounter the error, please share the correlation ID, request ID and timestamp that you get along with the error. I will try to track that in our backend database to identify the issue.

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.