Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


react-native-aad-b2c-sample

A sample implementation of ad-b2c-react-native that connects a React Native app to Azure AD B2C for social login

About The Project

Product Screen Shot

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.

Getting Started

  1. Clone the repo
git clone https://github.com/michaelburch/react-native-aad-b2c-sample.git
  1. Install NPM packages
cd react-native-aad-b2c-sample
npm install
  1. Update CocoaPods
 (cd ios && pod install)
  1. Launch on simulator
npx react-native run-ios

If 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.

Azure AD B2C Configuration

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.

App Registrations

Mobile App Registration

The mobile app (react-native-aad-b2c-sample) is configured with a single authentication platform and a single redirect URI.

Authentication Platform

For demonstrating access token usage, the mobile app has also been granted permission to the protected API (react-native-aad-b2c-sample-api)

Mobile App Permissions

Protected API Registration

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'):

API App Scope

This scope is referenced by the mobile app when an access token is requested at login.

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages