Refactor authentication and token handling.

This commit is contained in:
Mike Cao 2022-11-08 22:58:52 -08:00
parent 1a8c7c42f4
commit 67732b9b5a
7 changed files with 50 additions and 70 deletions

View file

@ -1,4 +1,4 @@
import { getRandomChars, parseSecureToken, parseToken } from 'next-basics';
import { parseSecureToken, parseToken } from 'next-basics';
import { getUser, getWebsite } from 'queries';
import debug from 'debug';
import { SHARE_TOKEN_HEADER, TYPE_USER, TYPE_WEBSITE } from 'lib/constants';
@ -6,10 +6,6 @@ import { secret } from 'lib/crypto';
const log = debug('umami:auth');
export function generateAuthToken() {
return `auth:${getRandomChars(32)}`;
}
export function getAuthToken(req) {
const token = req.headers.authorization;