Anson Geisel
03/10/2026, 7:34 PMnull and show as Unverified.
Steps to Reproduce
Log in and open the profile widget.
Observe values are present and verified.
Press F5 or click the browser refresh button.
1. After reload, the profile widget shows null values and Unverified status.DevRev
03/10/2026, 7:34 PM<AuthProvider
projectId="your-project-id"
persistTokens={true}
sessionTokenViaCookie={true}
autoRefresh={true}
>
Implement Session Recovery
Add session validation on page load to restore the user state:
import { useDescope, useSession } from '@descope/react-sdk'
const ProfileWidget = () => {
const { isAuthenticated, isSessionLoading } = useSession()
const { refresh } = useDescope()
useEffect(() => {
if (!isAuthenticated && !isSessionLoading) {
// Attempt to refresh session if refresh token exists
refresh().catch(() => {
// Handle failed refresh - redirect to login
})
}
}, [isAuthenticated, isSessionLoading])
if (isSessionLoading) return <div>Loading...</div>
if (!isAuthenticated) return <div>Please log in</div>
return <ProfileComponent />
}
• Set persistTokens={true} to store tokens in browser storage
• Use sessionTokenViaCookie={true} for better persistence across refreshes
• Enable autoRefresh={true} to automatically refresh expired sessions
OAuth with Client SDK | Descope Documentation