Skip to content

Commit 7bf6390

Browse files
Documentation edits made through Mintlify web editor
1 parent da32d97 commit 7bf6390

File tree

6 files changed

+582
-688
lines changed

6 files changed

+582
-688
lines changed

installation/authentication-setup.mdx

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,59 @@ title: "Authentication Setup"
33
sidebarTitle: Overview
44
---
55

6-
PowerSync clients (i.e. apps used by your users that embed the PowerSync Client SDK) authenticate against the server-side [PowerSync Service](/architecture/powersync-service) using [JWTs](https://jwt.io/) (signed tokens) that are generated by your application backend.
6+
# PowerSync Authentication Overview
7+
8+
PowerSync uses JSON Web Tokens (JWTs) for secure client authentication. These tokens are generated by your application backend and used by PowerSync clients to authenticate against the PowerSync Service.
9+
10+
## Initial Architecture
11+
12+
Before implementing PowerSync, a typical application architecture might look like this:
713

8-
Before using PowerSync, an application's existing architecture may look like this:
914
<Frame>
1015
<img src="/images/powersync-docs-architecture-diagram-001 (1).png"/>
1116
</Frame>
1217

13-
The [PowerSync Service](/architecture/powersync-service) uses database native credentials and authenticates directly against the [backend database](/installation/database-setup) using the configured credentials:
18+
## PowerSync Service Authentication
19+
20+
The PowerSync Service maintains a direct connection to your backend database using native credentials:
1421

1522
<Frame>
1623
<img src="/images/powersync-docs-architecture-diagram-002 (2).png"/>
1724
</Frame>
1825

19-
When the PowerSync client SDK is included in an app project, it uses [existing app-to-backend](/installation/app-backend-setup) authentication to [retrieve a JSON Web Token (JWT)](/installation/authentication-setup):
26+
## Client Authentication Flow
27+
28+
### Step 1: JWT Retrieval
29+
When integrated into your app, the PowerSync client SDK uses your existing app-to-backend authentication to obtain a JSON Web Token:
2030

2131
<Frame>
2232
<img src="/images/powersync-docs-architecture-diagram-004 (2).png"/>
2333
</Frame>
2434

25-
The PowerSync client SDK uses the retrieved JWT to authenticate directly against the PowerSync Service:
35+
### Step 2: PowerSync Service Connection
36+
The PowerSync client SDK then uses this JWT to establish a secure connection with the PowerSync Service:
2637

2738
<Frame>
2839
<img src="/images/powersync-docs-architecture-diagram-005 (2).png"/>
2940
</Frame>
3041

31-
Users are not persisted in PowerSync, and there is no server-to-server communication used for client authentication.
42+
<Note>
43+
PowerSync does not persist user information, and there is no server-to-server communication for client authentication.
44+
</Note>
45+
46+
## Authentication Options
3247

33-
Some authentication providers already generate JWTs for users which PowerSync can verify directly — see the documentation for individual providers (e.g. [Supabase Auth](/installation/authentication-setup/supabase-auth), [Firebase Auth](/installation/authentication-setup/firebase-auth))
48+
### Pre-configured Providers
49+
Some authentication providers generate JWTs that PowerSync can verify directly:
50+
- [Supabase Auth](/installation/authentication-setup/supabase-auth)
51+
- [Firebase Auth](/installation/authentication-setup/firebase-auth)
3452

35-
For others, some backend code must be added to your application backend to generate the JWTs needed for PowerSync — see [Custom](/installation/authentication-setup/custom) authentication.
53+
### Custom Authentication
54+
For other authentication systems, you'll need to add JWT generation code to your backend. See our [Custom](/installation/authentication-setup/custom) authentication guide for details.
3655

37-
For a quick way to get up and running during development, you can generate [Development Tokens](/installation/authentication-setup/development-tokens) directly from the [PowerSync Dashboard](/usage/tools/powersync-dashboard) (PowerSync Cloud) or locally with a self-hosted setup.
56+
### Development Tokens
57+
<Tip>
58+
For quick development and testing, you can generate [Development Tokens](/installation/authentication-setup/development-tokens) through the:
59+
- [PowerSync Dashboard](/usage/tools/powersync-dashboard) (PowerSync Cloud)
60+
- Local setup (self-hosted installations)
61+
</Tip>

0 commit comments

Comments
 (0)