Skip to main content

Sign In with Google

Follow this guide to sign in users with Google.

Google Sign In Preview

Sign Up for Google​

Create a Google Cloud Project​

πŸ’‘ You can skip this step if you already have a Google Cloud project you want to use.

  • Create a new Google Cloud project if you don't already have a project you want to use.
  • Search for OAuth consent screen in the top search bar in the Google Cloud Console.
  • Click on OAuth consent screen in the search results.
  • Select User Type External and click CREATE.

Edit app registration​

  • Fill in your App information.
  • Click SAVE AND CONTINUE.

Scopes​

  • Click SAVE AND CONTINUE.

Test User​

  • Click SAVE AND CONTINUE.

Summary​

  • Click BACK TO DASHBOARD.

Create Credentials​

  • Click on Credentials under APIs & Services in the left menu.
  • Click + CREATE CREDENTIALS and then OAuth client ID in the top menu.
  • On the Create OAuth client ID page for Application Type select Web application.
  • Under Authorized redirect URIs add your OAuth Callback URL from Nhost.
  • Click CREATE.

Configure Nhost​

  • A modal appears with your Google Client ID and Client Secret.
  • Copy and paste the Client ID and Client Secret from Google to your Nhost OAuth settings for Google. Make sure the OAuth provider is enabled in Nhost.
  • Click the checkbox β€œI have pasted the redirect URI into Google”.
  • Click Confirm settings.

Sign In Users​

Use the Nhost JavaScript client to sign in users:

nhost.auth.signIn({
provider: 'google'
})