FormidableLabs / react-native-app-auth

React native bridge for AppAuth - an SDK for communicating with OAuth2 providers
https://commerce.nearform.com/open-source/react-native-app-auth
MIT License
2.04k stars 441 forks source link

Unable to set it up with Azure AD B2C, Expo and iOS #1037

Open guanyou-git opened 3 days ago

guanyou-git commented 3 days ago

Issue

Started a new simple expo app, installed react-native-app-auth, configure the page as per this link with the correct values: https://commerce.nearform.com/open-source/react-native-app-auth/docs/providers/azure-active-directory-b2c

$ npx create-expo-app@latest $ npm i react-native-app-auth

configure code

`import { authorize } from 'react-native-app-auth';

export default function HomeScreen() {

const config = { issuer: 'https://.b2clogin.com/.onmicrosoft.com//v2.0', clientId: '', redirectUrl: 'msauth.com.appname://auth/', // the redirectUrl must end with a slash scopes: ['openid', 'offline_access'], };

const signIn = async () => { try { // Log in to get an authentication token const authState = await authorize(config); } catch (error) { console.error(error is ${error}); } };`

...

Step 1: Click here to Login

$ npx expo start

when clicking on the function that does the signIn, I'll get the error (NOBRIDGE) ERROR error is TypeError: Cannot read property 'authorize' of null

Have any1 managed to make this library work with azure AD B2C and expo

in azure AD B2C, I have tried to add both iOS application as well as mobile & desktop application redirect URI as well the B2C configuration is tested to work fine with Web/SPA for SSO sign in.

Environment

platform experiencing issue on: iOS react-native version: 0.76.3 react-native-app-auth version: ^8.0.0 using Expo: yes

carbonrobot commented 1 day ago

The following error indicates an issue with your applications code. Check to make sure the library is installed and the import is correctly specified in the component.

(NOBRIDGE) ERROR error is TypeError: Cannot read property 'authorize' of null