Skip to content

Commit

Permalink
Clarified parts of the docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Babsvik committed Dec 21, 2022
1 parent 85fe346 commit 658929d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/auth/oidc-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,24 @@ different providers is left to you to implement due to the various implementatio

Here we will demonstrate a minimal example of how you could do this using the package [react-native-app-auth](https://github.com/FormidableLabs/react-native-app-auth) to authenticate with the provider. Then after we have authenticated with the provider, we use the ID Token from the provider to authenticate with `react-native-firebase`. But you have to handle the flow to get the ID token and you should do things like logging the user out from the provider when they logout or revoke the token. Again this all depends on the provider, your flow and your use-case.

To get started with OIDC authentication you generally need to do the following:
# Getting started

To get started with OpenID Connect authentication you need to do the following:

1. Setup or get the configuration from the provider you want to use
2. Add the provider in the firebase console
3. Authenticate in the app using `react-native-app-auth` and `react-native-firebase`

## 1. Setup or get the configuration from the provider you want to use

As stated before, this will vary a lot from provider to provider and your use-case. You need to find and look the documentation for the provider you want to use.
As stated before, this will vary a lot from provider to provider and your use-case. You need to find and look the documentation for the provider you want to use and follow that documentation to setup a working provider.
You can see examples of "Tested OpenID providers" from [react-native-app-auth here](https://github.com/FormidableLabs/react-native-app-auth#tested-openid-providers) and how you do this will depend on what provider you want to use. But you need to complete the setup or configuration of the provider you want to use before you continue here.

## 2. Add the provider in the Firebase console

Doing the steps below will allow you to add the provider to the Firebase project.
If the provider is not added there, you won't be able to use the `signInWithCredential` method, since Firebase will not be able to use the credential if the provider does not exist in the project.

1. Firebase console in the project you want to add OpenID Connect to
2. Authentication
3. Sign-in method
Expand All @@ -34,6 +39,8 @@ You can see examples of "Tested OpenID providers" from [react-native-app-auth he

## 3. Authenticate in the app using "react-native-app-auth" and "react-native-firebase"

Before you use `react-native-app-auth` you have to complete the setup in their [docs](https://github.com/FormidableLabs/react-native-app-auth#getting-started).

The example below demonstrates how you could setup such a flow within your own application:

```jsx
Expand Down

0 comments on commit 658929d

Please sign in to comment.