You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: installation/authentication-setup/custom.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,13 +12,13 @@ The process is as follows:
12
12
13
13
1. The client authenticates the user using the app's authentication provider and typically gets a session token — either a third-party authentication provider or a custom one.
14
14
2. The client makes a backend call (authenticated using the above session token), which generates and signs a JWT for PowerSync.
15
-
1. For example implementations of this backend endpoint, see [Custom Backend Examples](/resources/demo-apps-example-projects#custom-backend-examples)
15
+
1. For example implementations of this backend endpoint, see [Custom Backend Examples](/resources/demo-apps-example-projects#custom-backend-examples)
16
16
3. The client connects to the PowerSync Service using the above JWT.
17
17
4. PowerSync verifies the JWT.
18
18
19
19
The requirements are:
20
20
21
-
A key-pair (private + public key) is required to sign and verify JWTs. The private key is used to sign the JWT,
21
+
A keypair (private + public key) is required to sign and verify JWTs. The private key is used to sign the JWT,
22
22
and the public key is advertised on a public JWKS URL.
23
23
24
24
Requirements for the key in the JWKS URL:
@@ -33,15 +33,15 @@ Requirements for the key in the JWKS URL:
33
33
5. Curve (`crv`) - only relevant for EdDSA and ECDSA:
34
34
1.`Ed25519` or `Ed448` for EdDSA
35
35
2.`P-256`, `P-384` or `P-512` for ECDSA
36
-
6. A `kid` must be specified, and must match the `kid` in the JWT.
36
+
6. A `kid` must be specified and must match the `kid` in the JWT.
37
37
38
38
Requirements for the signed JWT:
39
39
1. The JWT must be signed using a key in the JWKS URL.
40
40
2. JWT must have a `kid` matching the key in the JWKS URL.
41
41
3. The `aud` of the JWT must match the PowerSync instance URL.
42
42
1. To get the instance URL of a PowerSync instance when using PowerSync Cloud: In the project tree on the [PowerSync dashboard](https://powersync.journeyapps.com/), click on the "Copy instance URL" icon.
43
43
2. Alternatively, specify a custom audience in the instance settings.
44
-
4. The JWT must expire in 60 minutes or less. Specifically, both `iat` and `exp` fields must be present, with a difference of 3600 or less between the two.
44
+
4. The JWT must expire in 60 minutes or less. Specifically, both `iat` and `exp` fields must be present, with a difference of 3600 or less between them.
45
45
5. The user ID must be used as the `sub` of the JWT.
46
46
6. Additional fields can be added which can be referenced in Sync Rules [parameter queries](/usage/sync-rules/parameter-queries).
47
47
@@ -51,7 +51,7 @@ Since there is no way to revoke a JWT once issued without rotating the key, we r
51
51
52
52
#### Rotating Keys
53
53
54
-
If a private key is compromised, rotate they key on the JWKS endpoint.
54
+
If a private key is compromised, rotate the key on the JWKS endpoint.
55
55
56
56
PowerSync refreshes the keys from the endpoint every couple of minutes, after which old tokens will not be accepted anymore.
0 commit comments