mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 12:19:06 +00:00
With NextAuth, there is a race condition of the current implementation of refreshToken using multiple tab. Because getSession() is broadcasted (or triggered by another component, window focus or such), we may ask for the jwt() to be refreshed at the same time. The problem is the first time will go correctly, while all others calls will be rejected as they are using a revoked token. This redis lock is per-user, and will use redis lock as a source of truth.
12 lines
345 B
TypeScript
12 lines
345 B
TypeScript
"use client";
|
|
import { SessionProvider as SessionProviderNextAuth } from "next-auth/react";
|
|
import { SessionAutoRefresh } from "./SessionAutoRefresh";
|
|
|
|
export default function SessionProvider({ children }) {
|
|
return (
|
|
<SessionProviderNextAuth>
|
|
<SessionAutoRefresh>{children}</SessionAutoRefresh>
|
|
</SessionProviderNextAuth>
|
|
);
|
|
}
|