UNPKG

next-auth-hook

Version:

A simple React hook for NextAuth.js with Next.js App Router

24 lines (23 loc) 1.01 kB
/// <reference types="react" /> import type { User } from 'next-auth'; import type { SignOutParams, SignInOptions, SignInResponse, LiteralUnion } from 'next-auth/react'; import type { Session } from 'next-auth'; import type { BuiltInProviderType } from 'next-auth/providers/index'; type AuthContextType = { isAuthenticated: boolean; user: User | null; email: string | null; loading?: boolean; signOut: (a: SignOutParams) => Promise<void>; signIn: (provider: LiteralUnion<BuiltInProviderType>, options: SignInOptions) => Promise<SignInResponse | void>; session?: Session | null; }; declare const AuthContext: import("react").Context<AuthContextType>; declare const useSession: () => AuthContextType; type AuthProviderProps = { children?: React.ReactNode; }; declare const AuthProvider: ({ children }: AuthProviderProps) => import("react/jsx-runtime").JSX.Element; export default AuthProvider; export { AuthContext, useSession }; export type { AuthContextType, AuthProviderProps };