Skip to content

Commit

Permalink
changed invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmanos committed Sep 26, 2023
1 parent 42a2d69 commit 22b0399
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/openid4vci/grant_types/AuthorizationCodeGrant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ export async function authorizationCodeGrantTokenEndpoint(body: TokenRequestBody
.getOne();

if (!userSession) {
throw `No user session was found for authorization code ${body.code}`
throw new Error(`No user session was found for authorization code ${body.code}`)
}

userSession.state = undefined;
await AppDataSource.getRepository(AuthorizationServerState).save(userSession);

return generateAccessToken(userSession);
}
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,7 @@ export class OpenidForCredentialIssuingAuthorizationServerService implements Ope
// }
// if (!userSession.categorizedRawCredentials)
// throw new Error("Could not get categorized raw credential");

response = await authorizationCodeGrantTokenEndpoint(body, req.headers.authorization);
if (state.authorization_code) {
state.authorization_code = "";
await this.authorizationServerStateRepository.save(state);
}
}
catch (err) {
console.error("Error = ", err)
Expand Down

0 comments on commit 22b0399

Please sign in to comment.