Unable to add expo redirect Uri to the Azure AD B2C applications

Viewed 584

I am trying to implement Azure b2c using expo-auth-session. After the login on the browser and redirecting back to the app I get following error.

       "error": "redirect_uri_mismatch",
      "error_description": "AADB2C90006: The redirect URI 'https://auth.expo.io/@username/app-slug' provided in the request is not registered for the client id 'XXXXXXXX-XXXX-XXXXX-XXXXX

Timestamp: 2021-10-13 11:08:53Z

When I try to add it under the redirect Uri, I get the error shown in the attached image. enter image description here

Removing the @ from the username fixes the error but then it will not redirect back to the app.

Thanks in advance!!!

1 Answers

I dealt with this same problem. The validation is a bug in the Azure UI.

You can get around it by grabbing a valid request from the Chrome developer tools, modifying it to insert the @ symbol (e.g. grab a successful save without the @ symbol) from the network tab. It will looks something like this:

Picture of dev tools

Then right click that row for the request that was just made, "Copy" -> "Copy as cURL"

Get that text, paste it in a text editor where you can modify the inputs. You should be able to find the value that was modified in this request, and you can add in your @ symbol now.

Copy / paste it into your terminal so you can make the request, and, it'll work :) The server does not restrict the @ symbol from being there.

Related