Skip to content

Commit

Permalink
chore(docs): update refresh-token-rotation.mdx (#12135)
Browse files Browse the repository at this point in the history
Update refresh-token-rotation.mdx

- Rectify the typo in the example code for Next.js for error handling if the token refresh is unsuccessful.

-  Add a comment about wrapping the client component inside the SessionProvider component when using the useSession hook inside it for the same error handling example.
  • Loading branch information
riuandg5 authored Oct 28, 2024
1 parent 58f9ca4 commit 0cb248e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/pages/guides/refresh-token-rotation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ import { useEffect } from "react"
import { auth, signIn } from "@/auth"

export default async function Page() {
const session = await useSession()
const session = await auth()
if (session?.error === "RefreshTokenError") {
await signIn("google") // Force sign in to obtain a new set of access and refresh tokens
}
Expand All @@ -262,7 +262,7 @@ import { useEffect } from "react"
import { signIn, useSession } from "next-auth/react"

export default function Page() {
const { data: session } = useSession()
const { data: session } = useSession() // For this to work, the Page should be wrapped inside the SessionProvider component in Layout
useEffect(() => {
if (session?.error !== "RefreshTokenError") return
signIn("google") // Force sign in to obtain a new set of access and refresh tokens
Expand Down

0 comments on commit 0cb248e

Please sign in to comment.