Skip to main content
This guide will help you migrate from 0.x to 1.x of the Auth0 Next.js SDK.
If you only use environment variables to configure the SDK, you don’t need to create an instance of the SDK. You can use the named exports (handleAuth, getSession) directly from @auth0/nextjs-auth0 and they will lazily create an instance of the SDK for you, and configure it using environment variables.

Config Changes

If you still want to create the SDK instance yourself, note that the configuration options have changed as follows:
Breaking Changes
  • domain is now issuerBaseURL and should be a fully qualified URL
  • clientId is now clientID
  • redirectUri is now routes.callback and is a relative path, the full URL is constructed using baseURL
  • postLogoutRedirectUri is now routes.postLogoutRedirect and can be a relative path, the full URL is constructed using baseURL if no host is provided
  • scope and audience are optional and should be passed to authorizationParams
  • session.cookieSecret is now secret
  • session.cookieName is now session.name
  • session.cookieSameSite is now session.cookie.sameSite
  • session.cookieLifetime is now session.rollingDuration and defaults to 24 hrs rolling and 7 days absolute
  • session.cookiePath is now session.cookie.path and defaults to '/'
  • session.cookieDomain is now session.cookie.domain
  • session.storeIdToken, session.storeAccessToken, session.storeRefreshToken are no longer options. All tokens are stored by default, to remove anything from the session see the afterCallback option in handleCallback
  • oidcClient.httpTimeout is now httpTimeout and defaults to 5000 ms
  • oidcClient.clockTolerance is now clockTolerance defined in secs and defaults to 60 secs
See the API docs for a full list of configuration options.

getSession

getSession now requires a response as well as a request argument (any updates you make to the session object will now be persisted).
See the getSession docs.

getAccessToken

tokenCache has been removed in favor of a single getAccessToken method.
See the getAccessToken docs.

handleLogin

Breaking Changes
  • authParams is now authorizationParams
  • redirectTo is now returnTo
See the handleLogin docs.

handleLogout

redirectTo is now returnTo
See the handleLogout docs.

handleCallback

onUserLoaded is now afterCallback
See the handleCallback docs.