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
@@ -13,17 +13,27 @@ import { Code } from "@/components/Code"
13
13
### Installation
14
14
15
15
```bash npm2yarn
16
-
npm install @auth/surrealdb-adapter surrealdb.js
16
+
npm install @auth/surrealdb-adapter surrealdb
17
17
```
18
18
19
19
### Environment Variables
20
20
21
+
A valid authentication combination must be provided. The following authentication combinations are supported:
22
+
23
+
- RootAuth
24
+
- NamespaceAuth
25
+
- DatabaseAuth
26
+
- ScopeAuth
27
+
21
28
```sh
22
-
AUTH_SURREALDB_CONNECTION
23
-
AUTH_SURREALDB_USERNAME
24
-
AUTH_SURREALDB_PASSWORD
25
-
AUTH_SURREALDB_NS
26
-
AUTH_SURREALDB_DB
29
+
AUTH_SURREAL_URL (required)
30
+
AUTH_SURREAL_NS
31
+
AUTH_SURREAL_DB
32
+
AUTH_SURREAL_USER
33
+
AUTH_SURREAL_PW
34
+
AUTH_SURREAL_SCOPE
35
+
SURREAL_NS (required when using RootAuth or NamespaceAuth)
36
+
SURREAL_DB (required when using RootAuth or NamespaceAuth)
27
37
```
28
38
29
39
### Configuration
@@ -97,84 +107,172 @@ app.use(
97
107
98
108
The SurrealDB adapter does not handle connections automatically, so you will have to make sure that you pass the Adapter a `SurrealDBClient` that is connected already. Below you can see an example how to do this.
thrownewError("unsupported any auth configuration")
226
+
}
227
+
returnauth
228
+
}
229
+
```
230
+
100
231
### Authorization
101
232
102
-
#### Option 1 – Using RPC:
233
+
The clientPromise provides a connection to the database. You could use any connect option you wish. For quick setup, use the DatabaseAuth method. For best security, we recommend creating a Record Access method if you know how to properly setup access table permissions.
Copy file name to clipboardExpand all lines: docs/pages/getting-started/providers/mailgun.mdx
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,8 @@ AUTH_MAILGUN_KEY=abc
41
41
42
42
If you name your environment variable `AUTH_MAILGUN_KEY`, the provider will pick it up automatically and your Auth.js configuration object can be simpler. If you'd like to rename it to something else, however, you'll have to manually pass it into the provider in your Auth.js configuration.
43
43
44
+
3. If you are using the EU Mailgun server, you will need to include `region: "EU"` in the provider options. If you are using the US Mailgun server you can remove this option.
Copy file name to clipboardExpand all lines: docs/pages/guides/extending-the-session.mdx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ To have access to the user id, add the following to your Auth.js configuration:
34
34
```
35
35
36
36
During sign-in, the `jwt` callback exposes the user's profile information coming from the provider.
37
-
You can leverage this to add the user's id to the JWT token. Then, on subsequent calls of this API will have access to the user's id via `token.id`.
37
+
You can leverage this to add the user's id to the JWT token. Then, on subsequent calls of this API you will have access to the user's id via `token.id`.
38
38
Then, to expose the user's id in the actual session, you can access `token.id` in the `session` callback and save it on `session.user.id`.
39
39
40
40
Calls to `auth()` or `useSession()` will now have access to the user's id.
0 commit comments