1.x to 2.x of the Auth0 Next.js SDK.
Node 10 No Longer Supported
getSession Now Returns a Promise
- Before (v1)
- After (v2)
Client Methods and Components Now Exported Under /client
- Before (v1)
- After (v2)
updateSession Has Been Added
- Before (v1)
- After (v2)
Previously your application could make modifications to the session during the lifecycle of the request and those updates would be saved implicitly when the response’s headers were written:
getServerSidePropsWrapper Has Been Removed
Because the process of modifying the session is now explicit, you no longer have to wrap getServerSideProps in getServerSidePropsWrapper.
- Before (v1)
- After (v2)
Profile API Route No Longer Returns a 401
Previously the profile API route, by default at/api/auth/me, would return a 401 error when the user was not authenticated. While it was technically the right status code for the situation, it showed up in the browser console as an error. This API route will now return a 204 instead. Since 204 is a successful status code, it will not produce a console error.
Override Default Error Handler
You can now set the default error handler for the auth routes in a single place.- Before (v1)
- After (v2)
afterCallback Can Write to the Response
You can now write your own redirect header or terminate the request in afterCallback.
- Before (v1)
- After (v2)
Configure Default Handlers
Previously it was not possible to configure the default handlers. For example, to pass aconnection parameter to the login handler, you had to override it.
- Before (v1)
- After (v2)
It is still possible to override the default handlers if needed.