react
Client-side methods for NextAuth.js.
SessionProvider()β
Provider to wrap the app in to make session data available globally.
Can also be used to throttle the number of requests to the endpoint
/api/auth/session.
SessionProvider(
props:SessionProviderProps):Element
Parametersβ
| Parameter | Type |
|---|---|
props | SessionProviderProps |
Returnsβ
Element
signIn()β
Initiate a signin flow or send the user to the signin page listing all possible providers. Handles CSRF protection.
signIn<P>(
provider?:LiteralUnion<PextendsRedirectableProviderType?BuiltInProviderType|P:BuiltInProviderType,string>,options?:SignInOptions,authorizationParams?:SignInAuthorizationParams):Promise<PextendsRedirectableProviderType?SignInResponse|undefined:undefined>
Type parametersβ
Pextendsundefined|RedirectableProviderType=undefined
Parametersβ
| Parameter | Type |
|---|---|
provider? | LiteralUnion<P extends RedirectableProviderType ? BuiltInProviderType | P : BuiltInProviderType, string> |
options? | SignInOptions |
authorizationParams? | SignInAuthorizationParams |
Returnsβ
Promise<P extends RedirectableProviderType ? SignInResponse | undefined : undefined>
signOut()β
Initiate a signout, by destroying the current session. Handles CSRF protection.
signOut<R>(
options?:SignOutParams<R>):Promise<Rextends true ?undefined:SignOutResponse>
Type parametersβ
Rextendsboolean= true
Parametersβ
| Parameter | Type |
|---|---|
options? | SignOutParams<R> |
Returnsβ
Promise<R extends true ? undefined : SignOutResponse>
useSession()β
React Hook that gives you access to the logged in user's session data.
useSession<R>(
options?:UseSessionOptions<R>):SessionContextValue<R>
Type parametersβ
Rextendsboolean
Parametersβ
| Parameter | Type |
|---|---|
options? | UseSessionOptions<R> |
Returnsβ
SessionContextValue<R>
LiteralUnionβ
LiteralUnion: <
T,U>T|U&Record<never,never>
Util type that matches some strings literally, but allows any other string as well.
Sourceβ
https://github.com/microsoft/TypeScript/issues/29729#issuecomment-832522611
Type parametersβ
TextendsUU=string
SignInAuthorizationParamsβ
SignInAuthorizationParams:
string|string[][] |Record<string,string> |URLSearchParams
Match inputType of new URLSearchParams(inputType)