Skip to content

Google Authentication

You can use Google Authentication with Firebase or Supabase or the express-js app.

Google OAuth Setup

  1. Go to the Google Cloud Console.
  2. Go to the APIs & Services section.
  3. Go to the Credentials section.
  4. Click on Create Credentials and select OAuth client ID.
  5. Select the Application type as Web application.
    • Remember you will need to register multple credentials for multiple platforms i.e. web, android, ios, etc.
  6. Follow the instructions to create the credentials.
  7. In the Authorized redirect URIs field, add the following URIs:
    • http://localhost:3000/ (for Next)
    • http://localhost:8081/ (for Expo)
    • http://localhost:8080/ (for Express)
  8. In the Authorized JavaScript origins field, 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:

  1. Go to your firebase console.
  2. Go to the Authentication section.
  3. Select the Sign-in method tab.
  4. Enable the Google authentication provider.
  5. 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:

  1. Go to the supabase dashboard of your project.
  2. Go to the Authentication section.
  3. Click on the providers options.
  4. Enable the Google authentication.
  5. Use whichever OAuth provider you want to use for authentication (Google, etc.).
  6. We recommend using Google OAuth.
  7. Add the GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET and Authorized Client IDs for use with android/ios provided by the OAuth provider to the options provided in the dashboard.
  8. You will also get a callback URL here. Add it to the Authorized redirect URIs field in the Google Cloud Console of its respective project.

Express-app Setup

To use a custom REST API as your provider, follow these steps:

  1. Put the credentials i.e. GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET in the env file at backend/express-js/.env.
  2. Add respective callback URLs to the Authorized redirect URIs field 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.