kernelmed / Init

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auth0 React Native Embedded Sample

Custom Login Form

This sample creates a custom form that resembles the Hosted Login Page (HLP) using react-native components. It is not intended to be a complete replication of Lock. Upon successful authentication, the user will be taken to a Profile page which also demonstrates how to Call an API using your accessToken.

There is no storage of credentials in this sample as configuration is beyond the scope of this sample. React Native does not provide any secure storage facilities. You might want to look at a module such as:

The sample form is hardcoded with Facebook, Google social connections and a Username-Password-Authentication database connection. You will need to have these connections enabled in your Auth0 Dashboard

Important: Database Connection Authentication

Since June 2017 new Clients no longer have the Password Grant Type* enabled by default. This sample demonstrates database connection authentication using passwordRealm, so you will need to enable the Password Grant Type, please follow this guide.

Call API

Sample code is provided in app/screens/ProfileScreen.js using the native fetch component. You will need to change this value to a real URL for it to work.

Install

Install dependencies

npm install

Credentials

Add your client credentials

Add your native Auth0 client credentials to app/auth0-credentials.js, you can find these in your Auth0 Dashboard.

Configure Callback URL

Android

Open android/app/src/main/AndroidManifest.xml and replace {YOUR AUTH0 DOMAIN} with your Auth0 client domain value.

The Android project uses the callback scheme com.auth0sample

Add an entry to your Allowed Callback URLs in the Auth0 Dashboard with the value

com.auth0sample://{YOUR AUTH0 DOMAIN}/android/com.auth0sample/callback

iOS

The Android project uses the callback scheme auth0.samples.Auth0Sample

Add an entry to your Allowed Callback URLs in the Auth0 Dashboard with the value

auth0.samples.Auth0Sample://{YOUR AUTH0 DOMAIN}/ios/auth0.samples.Auth0Sample/callback

About


Languages

Language:JavaScript 68.2%Language:Objective-C 19.2%Language:Python 7.0%Language:Java 5.6%