mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-26 00:46:44 -05:00
docs(hooks): add returned and responseHeaders properties
This commit is contained in:
@@ -184,6 +184,26 @@ createAuthMiddleware(async (ctx) => {
|
||||
});
|
||||
```
|
||||
|
||||
#### Returned
|
||||
|
||||
The returned value from the hook is passed to the next hook in the chain.
|
||||
|
||||
```ts title="auth.ts"
|
||||
createAuthMiddleware(async (ctx) => {
|
||||
const returned = ctx.context.returned; //this could be a successful response or an APIError
|
||||
});
|
||||
```
|
||||
|
||||
#### Response Headers
|
||||
|
||||
The response headers added by endpoints and hooks that run before this hook.
|
||||
|
||||
```ts title="auth.ts"
|
||||
createAuthMiddleware(async (ctx) => {
|
||||
const responseHeaders = ctx.context.responseHeaders;
|
||||
});
|
||||
```
|
||||
|
||||
#### Predefined Auth Cookies
|
||||
|
||||
Access BetterAuth’s predefined cookie properties:
|
||||
|
||||
Reference in New Issue
Block a user