Skip to content

Commit

Permalink
throw bad request when max uses reached
Browse files Browse the repository at this point in the history
  • Loading branch information
maidul98 committed Dec 15, 2023
1 parent 7aa3cb5 commit 68eb0f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion backend/src/controllers/v1/universalAuthController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,14 @@ export const renewAccessToken = async (req: Request, res: Response) => {
accessTokenTTL,
accessTokenLastRenewedAt,
accessTokenMaxTTL,
createdAt: accessTokenCreatedAt
createdAt: accessTokenCreatedAt,
accessTokenNumUses,
accessTokenNumUsesLimit
} = identityAccessToken;

if (accessTokenNumUses >= accessTokenNumUsesLimit) {
throw BadRequestError({ message: "Unable to renew because access token number of uses limit reached" })
}

// ttl check
if (accessTokenTTL > 0) {
Expand Down

0 comments on commit 68eb0f8

Please sign in to comment.