Google Authentication
You can use Google Authentication with Firebase or Supabase or the express-js app.
Google OAuth Setup
- Go to the Google Cloud Console.
- Go to the
APIs & Servicessection. - Go to the
Credentialssection. - Click on
Create Credentialsand selectOAuth client ID. - Select the
Application typeasWeb application.- Remember you will need to register multple credentials for multiple platforms i.e. web, android, ios, etc.
- Follow the instructions to create the credentials.
- In the
Authorized redirect URIsfield, add the following URIs:http://localhost:3000/(for Next)http://localhost:8081/(for Expo)http://localhost:8080/(for Express)
- In the
Authorized JavaScript originsfield, add the following origins:http://localhost:3000(for Next)http://localhost:8081(for Expo)http://localhost:8080(for Express)
Firebase Setup
To use Google Authentication with Firebase as your provider, follow these steps:
- Go to your firebase console.
- Go to the
Authenticationsection. - Select the
Sign-in methodtab. - Enable the
Googleauthentication provider. - It should already have the client ID and client secret. If not, add them.
Supabase Setup
To use Google Authentication with Supabase as your provider, follow these steps:
- Go to the supabase dashboard of your project.
- Go to the
Authenticationsection. - Click on the providers options.
- Enable the
Googleauthentication. - Use whichever OAuth provider you want to use for authentication (Google, etc.).
- We recommend using Google OAuth.
- Add the
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETandAuthorized Client IDsfor use withandroid/iosprovided by the OAuth provider to the options provided in the dashboard. - You will also get a callback URL here. Add it to the
Authorized redirect URIsfield in the Google Cloud Console of its respective project.
Express-app Setup
To use a custom REST API as your provider, follow these steps:
- Put the credentials i.e.
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETin the env file atbackend/express-js/.env. - Add respective callback URLs to the
Authorized redirect URIsfield in the Google Cloud Console of its respective project.http://localhost:8080/v1/auth/google/callback(for Express)
After setting up the Google Authentication, you can use the signInWithGoogle function to sign in with Google.
Google Authentication should now be setup for your app for all providers.
Native Apps
For any issues with native apps, you can refer to the RN Google Authentication guide.