Issue with the authorisation code flow when MS admin has to give the access to a user

Sujith Dhanpal 0 Reputation points
2024-09-05T13:42:02.17+00:00

I have an azure application, that need delegated permissions of a user, and I am using /authorise API to get the auth code and there by token.

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client='XXXX'&scope='XXXX'&redirect_uri='XXXXX'&response_type='code'&state='XXXX'

Now the issue is, if admin consent settings is set as No, when the users authenticates, we are getting the callback with auth code to the provided redirect url.
Screenshot 2024-09-05 at 7.07.09 PM

But when it is set to yes, the consent goes to admin and after the admin approves, user has to again authenticate.

Is there any better to improve the experience?

One more issue with this is, I can't use consent=prompt, as it will always lead to admin granting the permissions to a user.

Azure Managed Applications
Azure Managed Applications
An Azure service that enables managed service providers, independent software vendors, and enterprise IT teams to deliver turnkey solutions through the Azure Marketplace or service catalog.
148 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,239 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Aleksandr Kolesnikov 636 Reputation points
    2024-09-05T22:48:40.7166667+00:00

    Hi @Sujith Dhanpal

    You can Enable the admin consent workflow.

    Then selected users who will receive email notifications for requests.

    User's image

    Then, responsible person need to Review and take action on admin consent requests

    Screenshot of the admin consent requests in the portal.

    If you'd like to provide same permissions for all users in organization, you need to Grant tenant-wide admin consent in Enterprise apps pane.

    Best regards,

    Aleksandr


    If the response is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

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.