From 284351abcf42813a5b4790a69aaba667f0142eaa Mon Sep 17 00:00:00 2001 From: Maxwell <145994855+ping-maxwell@users.noreply.github.com> Date: Mon, 8 Dec 2025 05:23:55 +1000 Subject: [PATCH] docs(bearer): explain bearer requests requirements better (#6591) --- docs/content/docs/plugins/bearer.mdx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/content/docs/plugins/bearer.mdx b/docs/content/docs/plugins/bearer.mdx index 2446c62d47..0775bb3d99 100644 --- a/docs/content/docs/plugins/bearer.mdx +++ b/docs/content/docs/plugins/bearer.mdx @@ -114,12 +114,15 @@ const response = await fetch("https://api.example.com/data", { const data = await response.json(); ``` -And in the server, you can use the `auth.api.getSession` function to authenticate requests: +On the server, you can authenticate requests using the `auth.api.getSession` function, +as long as the Authorization Bearer token header is present in the request: + ```ts title="server.ts" import { auth } from "@/auth"; export async function handler(req, res) { + // Make sure `req.headers` contains the Authorization Bearer token header! const session = await auth.api.getSession({ headers: req.headers });