Azure AD B2C Auth - useAuthRequest - redirectUri


OS: macOS 12.5.1
Shell: 5.8.1 - /bin/zsh
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
Yarn: 1.22.4 - ~/.yarn/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
CocoaPods: 1.11.3 - /usr/local/bin/pod
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android Studio: 2021.2 AI-212.5712.43.2112.8815526
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
expo: ~46.0.9 => 46.0.9
react: 18.0.0 => 18.0.0
react-dom: 18.0.0 => 18.0.0
react-native: 0.69.5 => 0.69.5
react-native-web: ~0.18.7 => 0.18.7
eas-cli: 0.60.0
expo-cli: 6.0.5
Expo Workflow: bare

The app have to auth to an Azure AD B2C and i use the hook to do it :

export const configAuth = {
  clientId: CLIENT_ID,
  scopes: ["openid"],
  responseType: ResponseType.IdToken,
  prompt: Prompt.Login,
  redirectUri: makeRedirectUri({ native: REDIRECT_URI[Platform.OS] }),
  extraParams: { p: POLICY }

const [request, result, promptAsync] = useAuthRequest(configAuth, { authorizationEndpoint });

i have to use this scheme :
android : msauth://

ios :

with ioS it’s ok it work perfectly

but with android, (from the browser) it can’t recognize “msauth://” and can’t back to the App

my app.config.js

const BUNDLE_ID = "";

  ios: {
    bundleIdentifier: BUNDLE_ID
  android: {
    package: BUNDLE_ID,

any suggestions?


i try to add my redirect URL for Android.
like that :

const BUNDLE_ID = "";

intentFilters: [
        action: "VIEW",
        autoVerify: true,
        data: [
            scheme: "msauth",
            host: BUNDLE_ID,
            path: "/2xmj3i5rSx0pEk%2FviWBYkE%2FZQrk%3D"
        category: ["BROWSABLE", "DEFAULT"]

I look at the changes on AndroidManifest.xml file

i do :
npx expo prebuild --clean --android

npx eas build --message auth-intent --profile development --platform android

but I still have chrome which tells me: “this site can’t be reached” when the login is finished

I’m also having issues getting Azure AD B2C to work with Expo AuthSession.

I’m developing for android using the managed workflow and have hit a wall where I get redirected but always see the webview saying “Something went wrong trying to finish signing in. Please close this screen to go back to the app.”

I can post my specs if needed, but first I just wanted to know if you solved your issues and if you’ve learned anything that you wish you knew from the start?



I finally found a solution for Android that didn’t understand the redirect. I did not configure correctly:
“intent-filter” in AndroidManifest.xml
I was missing an action

for example for this kind of redirect uri :

const scheme = "msauth://"

it looks :

    <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
        <action android:name=""/>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="msauth"/>
        <data android:host=""/>
        <data android:scheme="exp+xxx"/>

may be it can be done with “intentFilters” properties in app.config.js / app.json

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.