mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
feat: add api controllers and routes for browser extension
This commit is contained in:
11
app/api/tokens/lib/index.ts
Normal file
11
app/api/tokens/lib/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user