Skip to main content

Social Providers Configuration

Enabling Social Sign-In Provider

To start with social sign-in, select your project in Nhost Dashboard and go to UsersAuthentication Settings.

You need to set the Client ID and Client Secret for each provider that you want to enable.

Implementing sign-in experience

Use the Nhost JavaScript SDK and the signIn() method to implement social sign-in for your project.

Here's an example of how to implement sign-in with GitHub:

provider: 'github'

Users are redirected to your Nhost project's client URL by default. By default, your Nhost project's client URL is set to http://localhost:3000. You can change the value of your client URL in the Nhost console by going to UsersAuthentication SettingsClient URL.

Here is an example of how to redirect to another host or path:

provider: '<provider>'
options: {
redirectTo: "<host>/<slug>" // Example: ""

Provider OAuth scopes

Scopes are a mechanism in OAuth to allow or limit an application's access to a user's account.

By default, Nhost sets the scope to get the name, email, and avatar URL for each user. Editing scope is not currently supported.

Provider OAuth Tokens

Nhost saves both access and refresh tokens for each user and provider in the auth.user_providers table. These tokens can be used to interact with the provider if needed.