Skip to content

Commit 8afdfec

Browse files
fix(core): document that getToken returns null for malformed authorization headers
1 parent 5b1aa47 commit 8afdfec

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

packages/core/src/jwt.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ export interface GetTokenParams<R extends boolean = false>
137137
/**
138138
* Takes an Auth.js request (`req`) and returns either the Auth.js issued JWT's payload,
139139
* or the raw JWT string. We look for the JWT in the either the cookies, or the `Authorization` header.
140+
*
141+
* Returns `null` if no JWT is found in the cookies or `Authorization` header, and also when
142+
* the `Authorization` header's Bearer value contains malformed percent-encoding.
140143
*/
141144
export async function getToken<R extends boolean = false>(
142145
params: GetTokenParams<R>

0 commit comments

Comments
 (0)