# Supabase Auth

## Element States

The Auth element comes with a few states you can reference in your app in order to know the status of the Current User. All these states are always automatically updated either on page load, or after an action

* **isLoggedin** (Boolean): To know if the User has authenticated or not.
* **Access Token** (Text): This is needed for every call to Supabase.
* **Refresh Token** (Text): Refresh Token to refresh the session when expired.
* **Email** (Text): Email address of the authenticated User
* **UID** (Text): UUID of the Current User
* **Provider** (Text): How the user was signed up. For example: Email, Google, Facebook etc
* **Error** (Text): If there's any error, you can reference this state, which will be the error message Supabase returns. Use it with the Event **"Unhandled error happened"**.
* **Registration Date**: When the User was created.
* **Last Sign in Date**: Last time the User has authenticated.
* **Provider Token**: When using Oauth2 the plugin tries to return the Token of the Social Login provider.
* **Provider Refresh Token**: When using Oauth2 the plugin tries to return the Refresh Token of the Social Login provider.<br>

## Actions

#### Sign Up

Signs up the User. An Email address and Password Required.&#x20;

#### Log in

Log the User in. An Email address and Password Required.&#x20;

#### Log out

Logs out the User, and destroys the session.&#x20;

#### Sign in through OAuth

Sign in the User via one of your enabled Social Provider. Follow Supabase's guides on how to setup the relevant connections: <https://supabase.com/docs/guides/auth/social-login>

* **Scopes**: Add them as a Space-separated list of text. For sensitive scopes you might need to got through a verification process.

#### Update User's Password

Updates the password for the authenticated User

#### Update User's Email

Updates the email for the authenticated User

#### Send Password Reset Email

Sends an email to the user to Reset the password. This action will log the user in with the link. Use the [**Update User's Password**](#update-users-password) action to reset the password.&#x20;

#### Sign in via OTP

Signs in the user via a One Time Password.

#### Update User's Metadata

Updates the User's Metadata on the auth.user table. This is an advanced action. We recommend creating a separate public table for User settings and details, and setup proper Row Level Security.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.relevat.hu/supabase.js-bubble-plugin/setup/supabase-auth.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
