Skip to content

Commit

Permalink
Fix session auth/restore logic
Browse files Browse the repository at this point in the history
Problem: forbidden access to the logged endpoints after successful `auth/restore`.

Closes: metarhia#238
  • Loading branch information
KLarpen committed Dec 15, 2023
1 parent 2435b8e commit 940bc5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion application/api/auth/restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
const restored = context.client.restoreSession(token);
if (restored) return { status: 'logged' };
const data = await api.auth.provider.readSession(token);
return { status: data ? 'logged' : 'not logged' };
if (!data) return { status: 'not logged' };
context.client.startSession(token, data);
return { status: 'logged' };
},
});

0 comments on commit 940bc5f

Please sign in to comment.