Skip to content

Commit

Permalink
fix: auth server test
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Dec 7, 2023
1 parent 758cca1 commit acf8ab8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,16 +382,16 @@ app.post("/changeEmail", async (req, res) => {
app.get("/unverifyEmail", verifySession(), async (req, res) => {
let session = req.session;
await EmailVerification.unverifyEmail(accountLinkingSupported ? session.getRecipeUserId() : session.getUserId());
await session.fetchAndSetClaim(EmailVerification.EmailVerificationClaim);
await session.fetchAndSetClaim(EmailVerification.EmailVerificationClaim, {});
res.send({ status: "OK" });
});

app.post("/setRole", verifySession(), async (req, res) => {
let session = req.session;
await UserRoles.createNewRoleOrAddPermissions(req.body.role, req.body.permissions);
await UserRoles.addRoleToUser(session.getTenantId(), session.getUserId(), req.body.role);
await session.fetchAndSetClaim(UserRoles.UserRoleClaim);
await session.fetchAndSetClaim(UserRoles.PermissionClaim);
await session.fetchAndSetClaim(UserRoles.UserRoleClaim, {});
await session.fetchAndSetClaim(UserRoles.PermissionClaim, {});
res.send({ status: "OK" });
});

Expand Down Expand Up @@ -1011,6 +1011,7 @@ function initST() {
[
"session",
Session.init({
overwriteSessionDuringSignIn: true,
override: {
apis: function (originalImplementation) {
return {
Expand Down

0 comments on commit acf8ab8

Please sign in to comment.