Skip to content

Commit f75d680

Browse files
committed
New Supabase auth
1 parent dcef4e9 commit f75d680

File tree

9 files changed

+13
-16
lines changed

9 files changed

+13
-16
lines changed
71.2 KB
Loading
71.4 KB
Loading
107 KB
Loading

images/integration-2.png

-17.5 KB
Binary file not shown.

images/integration-4.png

-165 KB
Binary file not shown.

installation/authentication-setup/supabase-auth.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ You can implement various types of auth:
1717
* [Example](https://github.com/powersync-ja/powersync-jwks-example/)
1818
* Experimental: We've also heard from the community that Supabase's newly released [support for external auth providers works](https://supabase.com/blog/third-party-auth-mfa-phone-send-hooks), but we don't have any examples for this yet.
1919

20-
<Note>
21-
The "Supabase Auth" setting no longer works for Supabase projects created after 25 November 2024. While we are working with Supabase on a fix, please apply this workaround: https://releases.powersync.com/announcements/important-notice-for-supabase-users-using-supabase-jwts
22-
</Note>
20+
To implement either **Supabase Auth** or **Anonymous Sign-Ins**, enable the "Use Supabase Auth" setting on the PowerSync instance, and provide your Supabase JWT Secret. Internally, this setting allows PowerSync to verify and use Supabase JWTs directly using HS256 and the provided secret.
2321

24-
To implement either Supabase Auth or Anonymous Sign-Ins, enable the "Use Supabase Auth" setting on the PowerSync instance. (This is also [covered in the Supabase & PowerSync integration guide](/integration-guides/supabase-+-powersync#configuring-powersync))
22+
Enabling Supabase Auth is also [covered in the Supabase & PowerSync integration guide](/integration-guides/supabase-+-powersync#configuring-powersync).
2523

26-
Internally, Supabase auth signs the token using HS256, using a secret available as `current_setting('app.settings.jwt_secret')` on the database.
24+
To rotate the secret, generate a new secret in the your Supabase project's API Settings:
2725

28-
To rotate the secret, generate a new secret in the Supabase project settings. The new secret will be automatically picked up by PowerSync within 5 minutes. In this period, some authentication failures are expected.
26+
<Frame>
27+
<img src="/images/authentication/supabase-jwt-secret.png"/>
28+
</Frame>
2929

30-
The Supabase user UUID will be available as `token_parameters.user_id`. To use a different identifier as the user ID in sync rules (for example user email), use [Custom authentication](/installation/authentication-setup/custom).
30+
The Supabase user UUID will be available as `request.user_id()` in Sync Rules. To use a different identifier as the user ID in sync rules (for example user email), use [Custom authentication](/installation/authentication-setup/custom).

self-hosting/installation/powersync-service-setup.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ sync_rules:
113113
client_auth:
114114
# Enable this if using Supabase Auth
115115
# supabase: true
116+
# supabase_jwt_secret: [secret]
116117
117118
# JWKS URIs can be specified here.
118119
jwks_uri: http://demo-backend:6060/api/auth/keys

snippets/create-cloud-instance.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
1. In the [PowerSync Dashboard](/usage/tools/powersync-dashboard) Project tree, click on "**Create new instance**":
22

33
<Frame>
4-
<img src="/images/integration-2.png" width="60%" />
4+
<img src="/images/installation/create-new-instance.png" width="60%" />
55
</Frame>
66

77
2. Give your instance a name, such as "Testing".

snippets/supabase-database-connection.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@
1111
* Supabase also [refers to this password](https://supabase.com/docs/guides/database/managing-passwords) as the _database password_ or _project password_.
1212
* PowerSync has the Supabase CA certificate pre-configured — `verify-full` SSL mode can be used directly, without any custom certificates.
1313
2. Click **"Test Connection"** and fix any errors.
14-
3. Under the **"Client Auth"** tab, enable **"Use Supabase Auth"**:
15-
<Frame caption="PowerSync fetches the Supabase JWT key directly from the database.">
16-
<img src="/images/integration-4.png"/>
17-
</Frame>
14+
3. Under the **"Client Auth"** tab, enable **"Use Supabase Auth"** and enter your Supabase **JWT Secret**:
15+
<Frame caption="PowerSync uses the secret to verify Supabase's JWTs.">
16+
<img src="/images/authentication/use-supabase-auth.png"/>
17+
</Frame>
1818
4. Click **"Save".**
1919

20-
<Note>
21-
The "Supabase Auth" setting no longer works for Supabase projects created after 25 November 2024. While we are working with Supabase on a fix, please apply this workaround: https://releases.powersync.com/announcements/important-notice-for-supabase-users-using-supabase-jwts
22-
</Note>
23-
2420
PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.

0 commit comments

Comments
 (0)