Skip to content
generated from shottah/rnstarter

Built on `rnstarter` and adds custom authentication and authorization using Auth0 and Firebase.

Notifications You must be signed in to change notification settings

zed-io/rnauthstarter

Repository files navigation

rnauthstarter

This app uses Auth0, and Hasura.

Connecting Hasura

Following this guide to connect the app to Hasura with Authentication.

N.B. This app uses Auth0 instead of Firebase, and sections below will highlight differences in the steps from the document above.

Authentication

From the guide:

Since we will use JWT from Firebase, set HASURA_GRAPHQL_JWT_SECRET

Instead of using Firebase, we use Auth0. To connect Auth0 as the authentication provider for the Hasura instance, see this video, and continue after the above instruction.

Adding custom claims to Auth0, expected by Hasura:

Auth0 will inject custom claims into the JWT received by an authneticated user.

In order for Hasura to determine the role based access level of the authorized user, custom claims are added to Auth0's authorization response. See this link

The above document from Hasura uses Rules in Auth0 which is deprecated, use Actions instead.

See this link for how to add custom claims using Auth0 Actions.

Once the Hasura console has been updated with the jwk_url, and Auth0's authorization response returns Hasura's custom claim, the rest of the guide can be followed to configure role based access to various tables in the data store.

Issues

It was observed that the access token received from Auth0 was malformed, consisting of 3 segments instead of 5 segments.

When logging in using a passwordless SMS verification, it may be required to enter the audience of the receiving API auth0/react-native-auth0#349

About

Built on `rnstarter` and adds custom authentication and authorization using Auth0 and Firebase.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published