mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 04:19:32 +00:00
fix(bearer): certain sign-in endpoints won't give bearer token v2 (#4330)
This commit is contained in:
@@ -22,6 +22,15 @@ export const auth = betterAuth({
|
||||
});
|
||||
```
|
||||
|
||||
And in your auth client as well:
|
||||
|
||||
```ts title="auth-client.ts"
|
||||
import { bearerClient } from "better-auth/client/plugins";
|
||||
export const authClient = createAuthClient({
|
||||
plugins: [bearerClient()]
|
||||
});
|
||||
```
|
||||
|
||||
## How to Use Bearer Tokens
|
||||
|
||||
### 1. Obtain the Bearer Token
|
||||
@@ -57,7 +66,6 @@ export const authClient = createAuthClient({
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
You may want to clear the token based on the response status code or other conditions:
|
||||
|
||||
### 2. Configure the Auth Client
|
||||
@@ -137,3 +145,10 @@ export async function handler(req, res) {
|
||||
## Options
|
||||
|
||||
**requireSignature** (boolean): Require the token to be signed. Default: `false`.
|
||||
|
||||
**cookieName** (string): Custom cookie name for the temporary bearer token confirmation cookie. Default: `"bearer-token-confirmation"`.
|
||||
(For more information, [read here](https://github.com/better-auth/better-auth/pull/4330))
|
||||
|
||||
<Callout type="warn">
|
||||
If this value is changed, make sure to update the client plugin's `cookieName` option.
|
||||
</Callout>
|
||||
Reference in New Issue
Block a user