Options
All
  • Public
  • Public/Protected
  • All
Menu

Custom options to get an Access Token.

Hierarchy

  • AccessTokenRequest

Index

Properties

Optional afterRefresh

afterRefresh: undefined | AfterRefresh

When the Access Token Request refreshes the tokens using the Refresh Grant the Session is updated with new tokens. Use this to modify the session after it is refreshed. Usually used to keep updates in sync with the AfterCallback hook. See also the AfterRefetch hook

Modify the session after refresh

// pages/api/my-handler.js
import { getAccessToken } from '@auth0/nextjs-auth0';

const afterRefresh = (req, res, session) => {
  session.user.customProperty = 'foo';
  delete session.idToken;
  return session;
};

export default async function MyHandler(req, res) {
  const accessToken = await getAccessToken(req, res, {
    refresh: true,
    afterRefresh,
  });
};

Optional authorizationParams

authorizationParams: undefined | Partial<AuthorizationParameters>

This is useful for sending custom query parameters in the body of the refresh grant request for use in rules.

Optional refresh

refresh: undefined | boolean

If set to true, a new Access Token will be requested with the Refresh Token grant, regardless of whether the Access Token has expired or not.

Optional scopes

scopes: undefined | string[]

A list of desired scopes for your Access Token.