Notes
Any code below is just a sample implementation to demonstrate the API of the components. As-Is copy paste of below will not work.
Wrap root navigation routes with AppProvider
import React from 'react';
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import * as Linking from "expo-linking";
import { AuthProvider } from 'ad-b2c-react-native';
const Stack = createNativeStackNavigator<RootStackParamList>();
const prefix = Linking.createURL("/");
const linking = {
prefixes: [prefix],
};
export default function App() {
return (
<NavigationContainer linking={linking} fallback={<Text>Loading...</Text>}>
<AuthProvider
tenant= "<B2CAuthTenant>"
appId="<B2CAppID>"
loginPolicy="<B2CSignInPolicy>"
passwordResetPolicy="<B2CPasswordResetPolicy>"
profileEditPolicy="<B2CProfleEditPolicy>"
redirectURI={Linking.createURL("redirect")} //redirect uri
showInRecents = <Boolean>, // optional, default = false
createNewTask = <Boolean>, //optional, default = false
>
<Routes/>
</AuthProvider>
</NavigationContainer>
);
}
// See packages/b2c-samples/App.tsx for more