0

I am trying to implement a Microsoft Azure AD Login authentication on my Expo app. All the keys and IDs are set, but once I login with my account using the two factor authentication, Safari is unable to open the redirectUri.

It says: "Safari is unable to open the page because the address is invalid"

My redirectUri is set as msauth.com.negocie://auth (being 'com.negocie' the bundleID of my app)

Once I change it to redirectUri: makeRedirectUri({msauth.com.negocie:://auth}) it crashes the app

How should I authenticate my users?

Image of the error message saying "Safari is unable to open the page because the address is invalid", how do I configure a valid address?

gchan26
  • 25
  • 1
  • 6

1 Answers1

0

Please check the below points:

  1. Firstly When you’re certain the web address is spelled correctly, tap Refresh button in Safari to try loading it again or you can try again on a new device.

  2. When selecting the Public client (mobile & desktop) from dropdown,Register the correct redirect URLs in your tenant:

  3. iOS: msauth.<BUNDLE_ID>://auth. ex: msauth.energy.msal.example://auth

  4. Android: msauth://com.example/Xo8WBi6jzSxXXXXXXXX

Make sure you add your application's redirect URI scheme to your Info.plist file. Redirect URI scheme follows the format msauth.[app_bundle_id]. Make sure to substitute [app_bundle_id] with the Bundle Identifier for your application.

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>msauth. [app_bundle_id]</string>
        </array>
    </dict>
</array>

Please do Refer vmurin/react-native-azure-auth: React Native library implementing Azure AD OAuth2 API (github.com) and here

  • Configure AppDelegate.m file
  • Register a URL type entry using the value of CFBundleIdentifier as the value of CFBundleURLSchemes.

Check for technical workarounds.

  • You can clear your Safari cache (Settings > Safari > Clear History and Website Data) to remove the error. you can set the URI Scheme Deep Link Mode to “Conservative Mode” as said in referred links and Configure AppDelegate.m file in ios in the answer here

Note:The error may occur due to wrong URL Scheme.Check on info settings in XCode to check the correct scheme.

References:

  1. Check this > xamarin-native issues and reactjs - React Native iOS "Safari cannot open the page because the address is invalid" after valid login - Stack Overflow and make changes according to react native expo.
  2. AzureAD (MSAL) for iOS and macOS (github.com)
kavyaS
  • 8,026
  • 1
  • 7
  • 19