Skip to content

Authenticating users

By default, Turboship uses Auth.js to handle user authentication. Auth.js is a complete open-source authentication solution for Next.js applications. It is designed to work with any authentication provider and supports OAuth, OAuth 2.0, and passwordless authentication.

To configure Auth.js, just edit the apps/web/lib/auth.ts file.

Enabling "Sign in with Google"

To enable "Sign in with Google," you need to create a new project in the Google Cloud Console. After creating the project, you will need to configure the OAuth consent screen.

To configure the OAuth consent screen, go to the OAuth consent screen page and fill in the required fields. Make sure to add the following scopes:

  • openid
  • userinfo.profile
  • userinfo.email

After configuring the OAuth consent screen, you will need to create OAuth 2.0 client credentials. To do this, go to the Credentials page and click on the "Create credentials" button. Select "OAuth client ID" and choose "Web application" as the application type.

The "Authorized redirect URIs" used when creating the credentials must include your full domain and end in the callback path. For example;

Finally, copy the client ID and client secret and add them to the .env.local as GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET respectively.