If you're reading this post, you may already be familiar with Supabase. However, for those who are new, let me provide a brief introduction.
Supabase is an alternative to Firebase that utilizes PostgreSQL as its database and offers various features, including authentication, real-time capabilities, and storage.
To get started with Supabase, follow these steps:
-
Obtain the JWT key from the Supabase dashboard or through this link.
Never disclose your Jwt secret/token in public
Create a role in your SQL editor:
CREATE ROLE your_role;
GRANT your_role TO authenticator;
-- grant role privileges here
3.Visit jwt.io and populate the payload field with the following information:
{
"iss": "supabase",
"ref": "project ref id",
"role": "your_role",
"exp": 2001128702
}
Replace ref with your project reference ID from Dashboard
4.In the "Verify Signature" field, enter the JWT Token/Secret obtained in step 1.
Note: Default algorithm for JWT token is "HS256"
//Header
{
"alg": "HS256",
"typ": "JWT"
}
5.The "Encoded/Token" field will display the newly generated token. Copy this token and include it in your REST API or client code and requests as Authorization: Bearer new_generated_token
. This token will have all the privileges you gave to your_role role from sql editor in supabase dashboard.
Note: Please exercise caution when assigning sensitive data as this role will have the privileges you grant it.
Peace!
Top comments (0)