Forum Discussion

Fantilyre's avatar
Fantilyre
Copper Contributor
Jan 10, 2024

OneDrive login loop with API

Hello,

I am trying to let users connect to OneDrive from my website, using Microsoft Graph API, but when the user lands on the Microsoft login page, upon entering the email address for their Microsoft account then clicking "Next", instead of prompting for password or permissions, it loops back to inserting an email address. Any idea what the issue is ? I searched for a solution, without success.

This is the URL (I hid the client ID and URI here for privacy) :
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=X&redirect_uri=Y&response_type=code&scope=files.readwrite

Thanks for your time

EDIT: authorizations for this app in Microsoft Graph are :

Files.ReadWrite
Files.ReadWrite.AppFolder
offline_access
openid
User.Read

  • LeonPavesic's avatar
    LeonPavesic
    Silver Contributor

    Hi Fantilyre,

    Consider (double) checking the following:

    1. Redirect URI:
      Ensure that the redirect URI in your authorization URL precisely matches the one registered in your Azure app registration.

    2. App Registration:
      Verify that your app is correctly registered in the Azure portal. The client ID used in the authorization URL should align with the Application (client) ID in your app registration.

    3. Permissions:
      Confirm (double check) that the necessary permissions are granted in the Azure portal under "API permissions."
      The permissions you listed (Files.ReadWrite, Files.ReadWrite.AppFolder, offline_access, openid, User.Read) should typically cover most OneDrive operations.

    If you've reviewed all these aspects and the problem persists, consider using tools like Fiddler or Postman to capture HTTP requests and responses during the login process. This could offer more insights into the root cause.



    Please click Mark as Best Response & Like if my post helped you to solve your issue.
    This will help others to find the correct solution easily. It also closes the item.


    If the post was useful in other ways, please consider giving it Like.


    Kindest regards,


    Leon Pavesic
    (LinkedIn)

Resources