UNPKG

@wristband/react-client-auth

Version:

A lightweight React SDK that pairs with your backend server auth to initialize and sync frontend sessions via secure session cookies.

13 lines (10 loc) 439 B
import { useContext } from 'react'; import { WristbandAuthContext } from '../context/wristband-auth-context.js'; function useWristbandToken() { const context = useContext(WristbandAuthContext); if (context === undefined) { throw new Error('useWristbandToken() must be used within a WristbandAuthProvider.'); } return { clearToken: context.clearToken, getToken: context.getToken }; } export { useWristbandToken };