mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 14:43:24 +00:00
12 lines
276 B
TypeScript
12 lines
276 B
TypeScript
import { HttpContext } from '@adonisjs/core/http';
|
|
|
|
export function getTokenFromHeader(ctx: HttpContext) {
|
|
const authHeader = ctx.request.header('Authorization');
|
|
|
|
if (!authHeader || !authHeader.startsWith('Bearer ')) {
|
|
return null;
|
|
}
|
|
|
|
return authHeader.substring(7);
|
|
}
|