Thank you for posting your question in the Microsoft Q&A forum.
Please note that our forum is a public platform, and we will edit your image to hide your personal information in the description. Kindly ensure that you hide any personal or organizational information the next time you post an error or other details to protect personal data.
We’ll send a code to ***@gmail.com prompt is the Microsoft personal account (MSA) verification flow. In this case, the sign‑in is being routed to a consumer Microsoft account that’s associated with a Gmail address, instead of to the user’s work or school account.
This occurs when Microsoft cannot silently authenticate the user and falls back to Email One‑Time Passcode (OTP) verification. It typically happens if the browser already has an active Microsoft consumer (Gmail‑based) login session, while the user is trying to access a work or school account.
Here are some steps you may try to fix this issue:
1.Use InPrivate or Incognito mode for the next sign‑in, go directly to https://portal.office.com.
If the issue does not occur in InPrivate mode, it confirms a browser identity or cookie conflict.
2.Clear authentication cookies and cached tokens for these domains:
-login.microsoftonline.com,
-login.live.com,
-microsoft.com,
-office.com,
-teams.microsoft.com,
-outlook.com.
3.Sign out and remove any personal profile or broker session
-Windows: Settings > Accounts > Email & accounts > remove any Personal Microsoft account entries tied to Gmail.
-Edge: Settings > Profiles > Sign out of any personal profile.
-Office apps (Outlook/Teams/Office): Sign out all accounts, then sign in with work account.
4.Have users always access Office via: https://portal.office.com/?auth=2. This forces the work or school account authentication flow and prevents fallback to the consumer OTP (MSA) flow.
I hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.