The behavior you’re experiencing might be due to the way the Microsoft identity platform handles sessions. If a user is already logged in, the platform can directly authenticate the user and redirect them to the specified
redirect_uri. However, if the user is not logged in, they are first redirected to the login page and then to the
redirect_uri after successful login.
If the user is being redirected to office.com instead of your
redirect_uri after login, it could be due to a misconfiguration in your application settings in the Azure portal<sup>1</sup>. Here are a few things you can check:
- Redirect URI: Ensure that the
redirect_urispecified in your authorization request matches exactly with one of the Redirect URIs configured in your application settings in the Azure portal. The Redirect URI is case-sensitive and must include the protocol (http:// or https://).
- Application ID: Verify that the
client_idin your authorization request matches the Application (client) ID of your app in the Azure portal.
- Consent: If your app requires user consent, make sure that the user has granted consent. If consent is not granted, the user might be redirected to office.com after login.
Hope the Above will resolve the issue.