mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-11 04:19:31 +00:00
docs: add await to headers() calls in API examples
This commit is contained in:
committed by
GitHub
parent
169a03baef
commit
dd122da3e5
@@ -21,7 +21,7 @@ export const auth = betterAuth({
|
|||||||
|
|
||||||
// calling get session on the server
|
// calling get session on the server
|
||||||
await auth.api.getSession({
|
await auth.api.getSession({
|
||||||
headers: headers() //some endpoint might require headers
|
headers: await headers() // some endpoint might require headers
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ Unlike the client, the server needs the values to be passed as an object with th
|
|||||||
|
|
||||||
```ts title="server.ts"
|
```ts title="server.ts"
|
||||||
await auth.api.getSession({
|
await auth.api.getSession({
|
||||||
headers: headers()
|
headers: await headers()
|
||||||
})
|
})
|
||||||
|
|
||||||
await auth.api.signInEmail({
|
await auth.api.signInEmail({
|
||||||
@@ -39,7 +39,7 @@ await auth.api.signInEmail({
|
|||||||
email: "john@doe.com",
|
email: "john@doe.com",
|
||||||
password: "password"
|
password: "password"
|
||||||
},
|
},
|
||||||
headers: headers() // optional but would be useful to get the user IP, user agent, etc.
|
headers: await headers() // optional but would be useful to get the user IP, user agent, etc.
|
||||||
})
|
})
|
||||||
|
|
||||||
await auth.api.verifyEmail({
|
await auth.api.verifyEmail({
|
||||||
|
|||||||
Reference in New Issue
Block a user