test
This commit is contained in:
@@ -26,12 +26,15 @@ export const addAuth = (app: App) => {
|
||||
return;
|
||||
}
|
||||
if (!token) {
|
||||
app.throw(401, 'Token is required');
|
||||
ctx.throw(401, 'Token is required');
|
||||
}
|
||||
const user = await User.getOauthUser(token);
|
||||
console.log('auth user: exists', !user);
|
||||
if (!user) {
|
||||
app.throw(401, 'Token is invalid');
|
||||
ctx.throw(401, 'Token is invalid');
|
||||
return;
|
||||
}
|
||||
console.log(`auth user: ${user.username} (${user.id})`);
|
||||
const someInfo = getSomeInfoFromReq(ctx);
|
||||
if (someInfo.isBrowser && !ctx.req?.cookies?.['token']) {
|
||||
createCookie({ accessToken: token }, ctx);
|
||||
|
||||
Reference in New Issue
Block a user