AuthClient | @auth0/nextjs-auth0 - v4.4.0
Description: Documentation for @auth0/nextjs-auth0

# Class AuthClient

- Defined in src/server/auth-client.ts:144

#####
Index

### Constructors

constructor

### Methods

getConnectionTokenSet
getTokenSet
handleAccessToken
handleBackChannelLogout
handleCallback
handleLogin
handleLogout
handleProfile
handler
startInteractiveLogin

##
Constructors

### constructor

- new AuthClient(options: AuthClientOptions): AuthClient

  #### Parameters

  - options: AuthClientOptions

  #### Returns AuthClient

  - Defined in src/server/auth-client.ts:173

##
Methods

### getConnectionTokenSet

- getConnectionTokenSet(
  tokenSet: TokenSet,
  connectionTokenSet: undefined | ConnectionTokenSet,
  options: AccessTokenForConnectionOptions,
  ): Promise<
  [AccessTokenForConnectionError, null]
  | [null, ConnectionTokenSet],
  >

  Exchanges a refresh token for an access token for a connection.

  This method performs a token exchange using the provided refresh token and connection details. It first checks if the refresh token is present in the `tokenSet`. If not, it returns an error. Then, it constructs the necessary parameters for the token exchange request and performs the request to the authorization server's token endpoint.

  #### Parameters

  - tokenSet: TokenSet
  - connectionTokenSet: undefined | ConnectionTokenSet
  - options: AccessTokenForConnectionOptions

  #### Returns Promise<[AccessTokenForConnectionError, null] | [null, ConnectionTokenSet]>

  A promise that resolves to a tuple. The first element is either an `AccessTokenForConnectionError` if an error occurred, or `null` if the request was successful. The second element is either `null` if an error occurred, or a `ConnectionTokenSet` object containing the access token, expiration time, and scope if the request was successful.

  #### Throws

  If the refresh token is missing or if there is an error during the token exchange process.

  - Defined in src/server/auth-client.ts:1011

### getTokenSet

- getTokenSet(tokenSet: TokenSet): Promise<[SdkError, null] | [null, TokenSet]>

  getTokenSet returns a valid token set. If the access token has expired, it will attempt to refresh it using the refresh token, if available.

  #### Parameters

  - tokenSet: TokenSet

  #### Returns Promise<[SdkError, null] | [null, TokenSet]>

  - Defined in src/server/auth-client.ts:667

### handleAccessToken

- handleAccessToken(req: NextRequest): Promise<NextResponse<unknown>>

  #### Parameters

  - req: NextRequest

  #### Returns Promise<NextResponse<unknown>>

  - Defined in src/server/auth-client.ts:577

### handleBackChannelLogout

- handleBackChannelLogout(req: NextRequest): Promise<NextResponse<unknown>>

  #### Parameters

  - req: NextRequest

  #### Returns Promise<NextResponse<unknown>>

  - Defined in src/server/auth-client.ts:623

### handleCallback

- handleCallback(req: NextRequest): Promise<NextResponse<unknown>>

  #### Parameters

  - req: NextRequest

  #### Returns Promise<NextResponse<unknown>>

  - Defined in src/server/auth-client.ts:441

### handleLogin

- handleLogin(req: NextRequest): Promise<NextResponse<unknown>>

  #### Parameters

  - req: NextRequest

  #### Returns Promise<NextResponse<unknown>>

  - Defined in src/server/auth-client.ts:384

### handleLogout

- handleLogout(req: NextRequest): Promise<NextResponse<unknown>>

  #### Parameters

  - req: NextRequest

  #### Returns Promise<NextResponse<unknown>>

  - Defined in src/server/auth-client.ts:396

### handleProfile

- handleProfile(req: NextRequest): Promise<NextResponse<unknown>>

  #### Parameters

  - req: NextRequest

  #### Returns Promise<NextResponse<unknown>>

  - Defined in src/server/auth-client.ts:565

### handler

- handler(req: NextRequest): Promise<NextResponse<unknown>>

  #### Parameters

  - req: NextRequest

  #### Returns Promise<NextResponse<unknown>>

  - Defined in src/server/auth-client.ts:263

### startInteractiveLogin

- startInteractiveLogin(
  options?: StartInteractiveLoginOptions,
  ): Promise<NextResponse<unknown>>

  #### Parameters

  - options: StartInteractiveLoginOptions = {}

  #### Returns Promise<NextResponse<unknown>>

  - Defined in src/server/auth-client.ts:306