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 JavaScript origins, add your project’s redirect URL for the Google sign-in method in the following format: https://<subdomain>.auth.<region>.nhost.run
  • 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'
})