External Tenant - Redirect URI mismatch when logging in with Microsoft Account in Azure External ID / B2C tenant

Tan Yik Zhang 25 Reputation points
2025-11-13T05:52:42.84+00:00

I'm currently facing an issue with Microsoft Account (MSA) sign-in when using Azure External ID (External Identity / B2C).

When trying to sign in with a Microsoft Account under External Tenant / B2C, the authentication flow fails with the following error:

invalid_request: The provided value for the input parameter 'redirect_uri' is not valid. The expected value is a URI which matches a redirect URI registered for this client application.

DetailsUser's image

  • Tenant Type: Azure External Tenant (B2C)

Identity Provider: Microsoft Account (MSA)

Login scenario: Web app using OpenID Connect / OAuth2

  • Error Behavior:
    • For B2B users → works fine (redirects to login.live.com with redirect_uri=https://login.microsoftonline.com)
    • For B2C / External ID users → fails with redirect URI mismatch (redirects to login.live.com with redirect_uri=https://agtivexternal.ciamlogin.com)

The key difference I’ve observed:

  • In External Tenant / B2C, the redirect URI used is https://login.live.com/oauth20_authorize.srf?scope=openid+profile+email+offline_access&response_type=code&client_id=51483342-085c-4d86-bf88-cf50c7252078&response_mode=form_post&redirect_uri=https%3a%2f%agtivexternal.ciamlogin.com
  • In B2B, the redirect URI is
    https://login.live.com/oauth20_authorize.srf?scope=openid+profile+email+offline_access&response_type=code&client_id=51483342-085c-4d86-bf88-cf50c7252078&response_mode=form_post&redirect_uri=https%3a%2f%2flogin.microsoftonline.com

The ciamlogin.com domain seems to cause the redirect URI validation to fail.

Microsoft Security | Microsoft Entra | Microsoft Entra External ID
0 comments No comments

Answer accepted by question author
Anonymous
2025-11-14T08:42:16.67+00:00

Hi Zhang,

Thank you for posting your query on Microsoft Q&A.

This error means the redirect URI used during sign-in is not listed in your Azure app registration. Azure only accepts redirect URIs that are added exactly as they appear in the authentication request.

For example, if the sign-in flow sends users to:

https://agtivexternal.ciamlogin.com

but this URL is not added in your app registration, Azure will block the login with a redirect URI mismatch.

Steps to fix the issue:

  1. Copy the redirect URI from the error message The message will show the redirect URI Azure is expecting. Copy it exactly as shown.
  2. Add it to your app registration
    • Open the Azure Portal
      • Go to Microsoft Entra ID → App registrations
        • Select your application
          • Open Authentication
            • Under Redirect URIs, add the exact URI from step 1
              • Save your changes
              1. Make sure it matches perfectly The redirect URI must be identical, including https://, uppercase/lowercase letters, and any trailing slash.
              2. Clear your browser cache or use a private window Sometimes cached info causes the same error to appear even after fixing the URL.
              3. Try signing in again Once the correct redirect URI is added, the Microsoft Account login should work without issues.

Note:

  • If you have multiple environments (dev/test/prod), make sure each redirect URI is added.
  • Azure does not allow wildcard redirect URIs each one must be added individually.
  • The ciamlogin.com domain you’re seeing is normal in External ID/B2C flows, as long as it's part of your setup.

Microsoft documentation

I hope this information is helpful. Please feel free to reach out if you have any further questions. If the answer is helpful, please click "Accept Answer" and kindly upvote it.

Was this answer helpful?


0 additional answers

Sort by: Newest

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.