User Management
Introduction
Supabase makes it easy to manage your users.
When a user signs up, Supabase assigns them a unique ID. You can reference this ID anywhere in your database. For example, you might create a profiles
table references the user using a user_id
field.
Supabase provides the routes to sign up, login, log out, and manage users in your apps and websites.
Sign up
Allow your users to sign up and create a new account.
After they have signed up, all interactions using the Supabase JS client will be performed as "that user".
Log in
If an account is created, users can login to your app.
After they have logged in, all interactions using the Supabase JS client will be performed as "that user".
User data
Get the JSON data for the logged in user.
Log out
After calling log out, all interactions using the Supabase JS client will be "anonymous".
Error handling
Third Party Logins
You can enable Google OAuth by navigating to Authentication > Settings > Google Login and inputting your Client ID
and Secret
.
To fetch these you need to:
- Start a project on Google Cloud then navigate to
https://console.developers.google.com/apis/credentials?project=<your-project-id>
- Select Create Credentials > OAuth Client ID
- Select Application Type: Web Application
- Enter Authorized Redirect URI:
http://<your-project>.supabase.co/auth/v1/callback
You can now test your integration by navigating to: https://<your-project>.supabase.co/auth/v1/authorize?provider=google
. This is where you should send your users to authenticate.
After authenticating you should be redirected to <your-site-url>/#access_token=xyzabc&expires_in=3600&refresh_token=abcdef&token_type=bearer
. This site url can be updated on the Supabase dashboard at Authorization > Settings.
The user will now appear in your database in the auth.users
table.
You can now use the access_token in the url above in an Authorize header like: Authorization: Bearer xyzabc
when making requests to your REST or Realtime APIs in order to authenticate as that user. If using supabase-js then you can set the accessToken on the client:
If you require any help with these steps please contact alpha@supabase.io