Azure AD B2C Auth - expo-auth-session - redirectUri question

Hello :slight_smile:

Good morning, and in case I don’t see ya, good afternoon, good evening, and good night!

System:
      OS: macOS 12.5
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      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
    Managers:
      CocoaPods: 1.11.3 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    IDEs:
      Android Studio: 2021.2 AI-212.5712.43.2112.8815526
      Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^46.0.0 => 46.0.2
      react: 18.0.0 => 18.0.0
      react-dom: 18.0.0 => 18.0.0
      react-native: 0.69.4 => 0.69.4
      react-native-web: ~0.18.7 => 0.18.7
    npmGlobalPackages:
      eas-cli: 0.57.0
      expo-cli: 6.0.1
    Expo Workflow: bare

A few month ago, i made a POC to try to authenticate from my App to Azure i was working with Expo Go and it worked as expected.
When i was using makeRedirectUri() it returned this kind of URI : http://192.168.X.X:XXXX and the backend team had registered this.

But Now Backend team tell me to use this redirect uri (that they added on their side)

android : msauth://com.app.my/2pmj9i4rSx0yEb%XXXXXXXXX

ios : msauth.com.app.my://auth

can i still do it with : makeRedirectUri()

(com.app.my is not what i’m using … of course :slight_smile: )

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



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

and now i don’t really know what i should write in my app.config.js

const BUNDLE_ID = “com.app.my”;

 ios: {
    supportsTablet: true,
    bundleIdentifier: BUNDLE_ID,
    scheme: `msauth.${BUNDLE_ID}`
  },
  android: {
    package: BUNDLE_ID,
    scheme: `msauth://${BUNDLE_ID}/2pmj9i4rSx0yEb%2FviWBYkE%2FZQrk%3D`
  },

i know it’s not good because “scheme” will have :// in addition when makeRedirectUri() will be run

any idea ?

Thanks

i think the easiest way will be to do :

export const configAuth = {
  clientId: CLIENT_ID,
  scopes: ["openid"],
  prompt: Prompt.Login,
  redirectUri: makeRedirectUri({ native: "msauth.com.xxx.xxx://auth" }),
  extraParams: { p: POLICY }
};

but i will have 2 differents URI one for ios (like this example) and an other for android

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