A sample implementation of ad-b2c-react-native that connects a React Native app to Azure AD B2C for social login
This project demonstrates using Azure Active Directory B2C (AADB2C) for identity and access management in a React Native App. Social login with GitHub and Google are enabled, as well as sign up and sign in with e-mail.
AADB2C is an alternative to providers like Okta, Auth0 and AWS Cognito that simplifies mobile app authentication and allows you to avoid storing API credentials in your app.
- Clone the repo
git clone https://github.com/michaelburch/react-native-aad-b2c-sample.git- Install NPM packages
cd react-native-aad-b2c-sample
npm install- Update CocoaPods
(cd ios && pod install)- Launch on simulator
npx react-native run-iosIf anyone is running into issues with respect to running npx react-native run-android please update your gradle-wrapper.properties under Project->android->gradle->wrapper folder.
Also, if you'd like to change the AppID and Tenant please change them under Login.js file and replace with your credentials.
The sample is configured to use a live AADB2C tenant and connected Identity Providers so you can test logging in right away.
The sample tenant has two applications registered. A mobile app, and a protected API. This enables users logging in to the mobile app to be automatically issued an access token which is used to access the protected API.
The mobile app (react-native-aad-b2c-sample) is configured with a single authentication platform and a single redirect URI.
For demonstrating access token usage, the mobile app has also been granted permission to the protected API (react-native-aad-b2c-sample-api)
The protected API app (react-native-aad-b2c-sample-api) is registered with a web authentication platform and redirect URI. What's important for this sample is the API exposes a single scope ('read'):
This scope is referenced by the mobile app when an access token is requested at login.




