This commit is contained in:
@@ -5,8 +5,8 @@ import { sign } from './jwt';
|
||||
export const getAuthenticationBundle = async (username: string, password: string) => {
|
||||
const auth = await Auth.findByUsername(username).catch();
|
||||
const isAuthenticated = !!auth && (auth as AuthModel).authenticate(password);
|
||||
const record = isAuthenticated ? (auth as AuthPrivate).record : null;
|
||||
const token = isAuthenticated ? (auth as AuthModel).getToken() : sign();
|
||||
const record = isAuthenticated ? (auth as AuthPrivate).record as string : null;
|
||||
const token = sign(record || undefined);
|
||||
return {
|
||||
record,
|
||||
token,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import jsonwebtoken, { JwtPayload } from 'jsonwebtoken';
|
||||
import jwt from 'jsonwebtoken';
|
||||
|
||||
export interface TokenProps {
|
||||
aud?: string;
|
||||
|
||||
Reference in New Issue
Block a user