mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 20:37:46 +00:00
21 lines
633 B
Plaintext
21 lines
633 B
Plaintext
---
|
|
title: Bearer
|
|
description: The Bearer plugin allows you to authenticate with a Bearer token instead of a browser cookie.
|
|
---
|
|
|
|
The Bearer plugin allows you to authenticate with a Bearer token instead of a browser cookie. It proxies the request and set the bearer token in the Authorization header to a cookie request internally.
|
|
|
|
## Add the Bearer plugin
|
|
|
|
```ts title="auth.ts" twoslash
|
|
import { betterAuth } from "better-auth";
|
|
import { bearer } from "better-auth/plugins";
|
|
|
|
export const { api, handler } = betterAuth({
|
|
database: {
|
|
provider: 'sqlite',
|
|
url: './db.sqlite'
|
|
},
|
|
plugins: [bearer()]
|
|
});
|
|
``` |