Enabling Social Sign-In Provider
To start with social sign-in, select your project in Nhost Dashboard and go to Settings -> Sign-In Methods.
Implementing sign-in experience
signIn() method to implement social sign-in for your project.
Example: Sign in a user with GitHub.
During the sign-in flow, the user is redirected to the provider's website to authenticate. After the user authenticates, they are redirected back to your Nhost project's Client URL by default. You can change where the user gets redirected to after authentication by passing the
Example: Redirect the user to
https://staging.example.com/welcome after they complete the sign-in flow.
In the example above, it's important to note that the
redirectTo URL must be part of the Allowed Redirect URLs of your Nhost project.
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.