https://www.npmjs.com/package/@eartho/one-client-js

For this app, I am going to use Eartho One to giving ready built in high converting experience and Firebase Auth to manage user login and authentication. In this scenario, my app needs to communicate with Firebase Auth directly to obtain an authentication token and after that, I will add this token to every request send to my backend.

Ingredients

First, you need to create your React Native app. I assume you already know how to do this but in case something is not clear here is a guide
https://reactnative.dev/docs/environment-setup

You will also need to get Firebase set up. You can find instructions for doing that in the official Firebase docs. Be sure to include your SHA-1 key when you’re adding your Android app to the Firebase console (you can find instructions for finding your SHA-1 in Android’s official docs). This will be necessary when using Google Sign-In and Email Link authentication.
https://rnfirebase.io/auth/usage

STEP-BY-STEP INSTRUCTIONS

1. Create Access Points in Eartho Creators

1A. Begin by connecting to Eartho Creators

2B. Make your very first entity by click on “Create Entity” on the creators home screen. Entity can be a website, app, event, or anything else for which you want to manage access.

3C. After creating the entity, you will see “Create Access” on the entity page. Begin by creating the access points you want us to manage; it can be “login” or “premium package” or anything that gives your users/clients access for something.

2. Integrating Eartho into your app

Add Eartho into your app

npm i @eartho/one-client-react-native

iOS folder:

1. Add URL type

https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app
Example: https://ibb.co/8dkYwmT -

Identifier: eartho
URL Schemes: $(PRODUCT_BUNDLE_IDENTIFIER)

2. Add to info

<key>ClientId</key><string>YOUR_EARTHO_CLIENT_ID</string><key>ClientSecret</key><string>YOUR_EARTHO_SECRET</string>

3. Build the UI and add this code

import { init, connectWithRedirect, getIdToken, getUser } from '@eartho/one-client-react-native';//1. Init the sdk
React.useEffect(() => {
init(
"Client Id - e.g. qoWhmh4vAEZnE5Naig0b",
"Client Secret Key From Creators - e.g. -----BEGIN PUBLIC KEY-----")
}, []);
//2. open the access dialog
connectWithRedirect("access id: e.g. V1te8aEqOJNtPseu3VTe")
//3. Get id token or userconsole.log(await getIdToken());
console.log(await getUser());

3. Integrate Eartho Into Firebase Auth

Create certificate file in google
https://console.cloud.google.com/iam-admin/serviceaccounts?authuser=0

And follow this video
https://youtu.be/wpbHI-4W33g

Save the json file

Now go to https://creator.eartho.world/
Select your entity
Pick security tab
And change environment to Firebase Auth.

Take the content from the json file and paste it in the website.

Thats it !
You done

https://www.npmjs.com/package/@eartho/one-client-js

--

--

Eartho

Rapidly integrate authentication, user profiles, authorization, and integrated payments, all combined with one SDK and admin dashboard. https://eartho.io