Skip to content

Commit

Permalink
Warn on concurrent request
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-sherman committed Sep 7, 2024
1 parent 14b31d7 commit 2d99e00
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/frontpage/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,18 @@ export async function middleware(_request: NextRequest) {
result = await processRefreshTokenResponse(authServer, client, response);
}

if (
"error" in result &&
result.error === "invalid_grant" &&
result.error_description === "refresh token replayed"
) {
// Concurrent refresh token replayed, just ignore for now
console.warn("Concurrent refresh token replayed");
return NextResponse.next();
}

if ("error" in result) {
// Logout and show error
// TODO: Sometimes this error is refresh token replayed probably because middleware is concurrent. Fix this.
console.error(result);
throw new Error("not implemented");
}
Expand Down

0 comments on commit 2d99e00

Please sign in to comment.