Need admin approval while authorizing onedrive using oauth2.0

Mageshwari SS 20 Reputation points
2024-12-24T12:27:05.3266667+00:00

Hi Support Team,

The error "Needs admin approval" appeared when we attempted to authorize our OneDrive account using Oauth 2.0.

The below urls are used for authorization

AuthURL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize

Access Token URL: https://login.microsoftonline.com/common/oauth2/v2.0/token

Scope: offline_access files.readwrite.all

Clientid and clientsecret are created in microsoft azure portal of free trail account

For your reference i have attached the screenshot of issue Onedrive Authorization issue.png

Thanks and Regards,

Mageshwari

Microsoft Authenticator
Microsoft Authenticator
A Microsoft app for iOS and Android devices that enables authentication with two-factor verification, phone sign-in, and code generation.
7,682 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Divyesh Govaerdhanan 410 Reputation points
    2024-12-27T16:27:21.24+00:00

    Hello,

    Welcome to Microsoft Q&A,

    If the application is not pre-approved by the organization or if it’s running in a personal (non-enterprise) tenant, admin consent is mandatory if the scope has high-previlage access.

    1. files.readwrite.all Scope: This permission grants access to all files in the user's OneDrive, which is a high-privilege scope requiring admin approval.

    Grant Admin Consent (If you have admin access)

    1. Log into Azure Portal: Azure Portal.
    2. Navigate to Microsoft Entra ID --> Enterprise Applications --> Your Application.
    3. Click Permissions under Security in the left-hand menu.
    4. Click Grant admin consent for <tenant name>.
    5. Confirm the action.

    If you don't have admin access, construct and send the below URL for the admin to provide consent to the application.

    https://login.microsoftonline.com/<tenant-id>/adminconsent?client_id=<client-id>

    Please Upvote and accept the answer if it helps!

    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.