dev: ensure existing app tokens don't break (for now)

This commit is contained in:
KernelDeimos 2024-10-24 19:54:29 -04:00
parent 6b8fbda14c
commit f55b7ac0b8

View File

@ -85,12 +85,16 @@ class AuthService extends BaseService {
} }
if ( decoded.type === 'app-under-user' ) { if ( decoded.type === 'app-under-user' ) {
let session;
if ( decoded.session ) {
const session_uuid = this.uuid_fpe.decrypt(decoded.session); const session_uuid = this.uuid_fpe.decrypt(decoded.session);
const session = await this.get_session_(session_uuid); session = await this.get_session_(session_uuid);
if ( ! session ) { if ( ! session ) {
throw APIError.create('token_auth_failed'); throw APIError.create('token_auth_failed');
} }
}
const user = await get_user({ uuid: decoded.user_uid }); const user = await get_user({ uuid: decoded.user_uid });
if ( ! user ) { if ( ! user ) {
throw APIError.create('token_auth_failed'); throw APIError.create('token_auth_failed');
@ -104,6 +108,7 @@ class AuthService extends BaseService {
const actor_type = new AppUnderUserActorType({ const actor_type = new AppUnderUserActorType({
user, user,
app, app,
session,
}); });
return new Actor({ return new Actor({