Skip to content

Commit

Permalink
Merge pull request #859 from auth0/release/v2.0.0-beta.0
Browse files Browse the repository at this point in the history
Release v2.0.0-beta.0
  • Loading branch information
adamjmcgrath authored Oct 19, 2022
2 parents 0c7ed6d + 065b933 commit abf36aa
Show file tree
Hide file tree
Showing 61 changed files with 5,607 additions and 963 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ workflows:
context:
- browserstack-env
- ship/node-publish:
publish-command: npm publish --tag beta
requires:
- build
context:
Expand All @@ -51,4 +52,4 @@ workflows:
filters:
branches:
only:
- main
- vNext
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,64 @@
# Change Log

## [v2.0.0-beta.0](https://github.com/auth0/nextjs-auth0/tree/v2.0.0-beta.0) (2022-10-11)

[Full Changelog](https://github.com/auth0/nextjs-auth0/compare/v1.9.1...v2.0.0-beta.0)

- Change updateUser to updateSession [\#855](https://github.com/auth0/nextjs-auth0/pull/855) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Add support for configuring the default handlers [\#840](https://github.com/auth0/nextjs-auth0/pull/840) ([Widcket](https://github.com/Widcket))
- Allow response customization in afterCallback [\#838](https://github.com/auth0/nextjs-auth0/pull/838) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Improved callback errors [\#835](https://github.com/auth0/nextjs-auth0/pull/835) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Add support for configuring the built-in handlers [\#826](https://github.com/auth0/nextjs-auth0/pull/826) ([Widcket](https://github.com/Widcket))
- Prevent mixing named exports and own instances [\#825](https://github.com/auth0/nextjs-auth0/pull/825) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Default error handler [\#823](https://github.com/auth0/nextjs-auth0/pull/823) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Fix intermittent build issues [\#818](https://github.com/auth0/nextjs-auth0/pull/818) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Add testing utility for generating session cookies [\#816](https://github.com/auth0/nextjs-auth0/pull/816) ([Widcket](https://github.com/Widcket))
- Next.js Middlware support [\#815](https://github.com/auth0/nextjs-auth0/pull/815) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Fix v1 cookie tests [\#810](https://github.com/auth0/nextjs-auth0/pull/810) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Do not store the ID token by default [\#809](https://github.com/auth0/nextjs-auth0/pull/809) ([Widcket](https://github.com/Widcket))
- Allow to override the user prop in server-side rendered pages [\#800](https://github.com/auth0/nextjs-auth0/pull/800) ([Widcket](https://github.com/Widcket))
- Improve API docs [\#796](https://github.com/auth0/nextjs-auth0/pull/796) ([Widcket](https://github.com/Widcket))
- Return 204 from /api/auth/me when logged out [\#791](https://github.com/auth0/nextjs-auth0/pull/791) ([Widcket](https://github.com/Widcket))
- Refactor session lifecycle [\#787](https://github.com/auth0/nextjs-auth0/pull/787) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Improve errors [\#782](https://github.com/auth0/nextjs-auth0/pull/782) ([Widcket](https://github.com/Widcket))

See [V2 Migration Guide](./V2_MIGRATION_GUIDE.md) for full details.

## [v1.9.2](https://github.com/auth0/nextjs-auth0/tree/v1.9.2) (2022-10-07)

[Full Changelog](https://github.com/auth0/nextjs-auth0/compare/v1.9.1...v1.9.2)

**Added**

- Fix updates to session not reflected in async `getServerSideProps` [\#843](https://github.com/auth0/nextjs-auth0/pull/843) ([adamjmcgrath](https://github.com/adamjmcgrath))

## [v1.9.1](https://github.com/auth0/nextjs-auth0/tree/v1.9.1) (2022-06-16)

[Full Changelog](https://github.com/auth0/nextjs-auth0/compare/v1.9.0...v1.9.1)

**Fixed**

- Add Props and Query to GetServerSidePropsWrapper type [\#731](https://github.com/auth0/nextjs-auth0/pull/731) ([adamjmcgrath](https://github.com/adamjmcgrath))

## [v1.9.0](https://github.com/auth0/nextjs-auth0/tree/v1.9.0) (2022-05-20)

[Full Changelog](https://github.com/auth0/nextjs-auth0/compare/v1.8.0...v1.9.0)

**Added**

- [SDK-3332] Constrain session lifecycle to `withPageAuthrequired` to avoid Next warning [\#664](https://github.com/auth0/nextjs-auth0/pull/664) ([adamjmcgrath](https://github.com/adamjmcgrath))

## [v1.8.0](https://github.com/auth0/nextjs-auth0/tree/v1.8.0) (2022-05-04)

[Full Changelog](https://github.com/auth0/nextjs-auth0/compare/v1.7.0...v1.8.0)

**Added**

- Add some useful props to the callback error [\#625](https://github.com/auth0/nextjs-auth0/pull/625) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Update to next 12 [\#612](https://github.com/auth0/nextjs-auth0/pull/612) ([adamjmcgrath](https://github.com/adamjmcgrath))

**Fixed**

- Fix Fast Refresh for WithPageAuthRequired [\#653](https://github.com/auth0/nextjs-auth0/pull/653) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Handle request errors on `useUser` hook [SDK-3227] [\#639](https://github.com/auth0/nextjs-auth0/pull/639) ([Widcket](https://github.com/Widcket))
- Add default to PageRoute type parameter [\#632](https://github.com/auth0/nextjs-auth0/pull/632) ([grantbdev](https://github.com/grantbdev))
Expand All @@ -34,40 +67,51 @@
- Fix types in client-side `withPageAuthRequired` [\#574](https://github.com/auth0/nextjs-auth0/pull/574) ([slaypni](https://github.com/slaypni))

## [v1.7.0](https://github.com/auth0/nextjs-auth0/tree/v1.7.0) (2022-01-06)

[Full Changelog](https://github.com/auth0/nextjs-auth0/compare/v1.6.2...v1.7.0)

**Added**

- Include message body in 302 responses [\#564](https://github.com/auth0/nextjs-auth0/pull/564) ([michielvangendt](https://github.com/michielvangendt))

**Fixed**

- Honor configured sameSite in transient cookies so you can login to iframe using 'none' [\#571](https://github.com/auth0/nextjs-auth0/pull/571) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Cookies with samesite=none must have the secure attr set [\#570](https://github.com/auth0/nextjs-auth0/pull/570) ([adamjmcgrath](https://github.com/adamjmcgrath))
- Improve types in server-side withPageAuthRequired [\#554](https://github.com/auth0/nextjs-auth0/pull/554) ([misoton665](https://github.com/misoton665))

## [v1.6.2](https://github.com/auth0/nextjs-auth0/tree/v1.6.2) (2021-12-16)

[Full Changelog](https://github.com/auth0/nextjs-auth0/compare/v1.6.1...v1.6.2)

**Fixed**

- Fix issue where error reporting wrong instanceof [\#543](https://github.com/auth0/nextjs-auth0/pull/543) ([adamjmcgrath](https://github.com/adamjmcgrath))

**Security**

- Enforce configured host on user supplied returnTo [\#557](https://github.com/auth0/nextjs-auth0/pull/557) ([adamjmcgrath](https://github.com/adamjmcgrath))

## [v1.6.1](https://github.com/auth0/nextjs-auth0/tree/v1.6.1) (2021-10-13)

[Full Changelog](https://github.com/auth0/nextjs-auth0/compare/v1.6.0...v1.6.1)

**Fixed**

- [Snyk] Upgrade openid-client from 4.8.0 to 4.9.0 [\#518](https://github.com/auth0/nextjs-auth0/pull/518) ([snyk-bot](https://github.com/snyk-bot))

## [v1.6.0](https://github.com/auth0/nextjs-auth0/tree/v1.6.0) (2021-10-11)

[Full Changelog](https://github.com/auth0/nextjs-auth0/compare/v1.5.0...v1.6.0)

**Added**

- [SDK-2818] Export error classes [\#508](https://github.com/auth0/nextjs-auth0/pull/508) ([adamjmcgrath](https://github.com/adamjmcgrath))
- [SDK-2529] Add ability to pass custom params to refresh grant and code exchange [\#507](https://github.com/auth0/nextjs-auth0/pull/507) ([adamjmcgrath](https://github.com/adamjmcgrath))
- [SDK-2813] Add afterRefresh hook [\#506](https://github.com/auth0/nextjs-auth0/pull/506) ([adamjmcgrath](https://github.com/adamjmcgrath))

**Fixed**

- Fix types in server-side `withPageAuthRequired` [\#512](https://github.com/auth0/nextjs-auth0/pull/512) ([Widcket](https://github.com/Widcket))

## [1.5.0](https://github.com/auth0/nextjs-auth0/tree/v1.5.0) (2021-07-14)
Expand Down
20 changes: 20 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,26 @@ export default withMiddlewareAuthRequired(async function middleware(req) {
});
```

For using middleware with your own instance of the SDK:

```js
// middleware.js
import {
withMiddlewareAuthRequired,
getSession,
initAuth0 // note the mw specific `initAuth0`
} from '@auth0/nextjs-auth0/middleware';

const auth0 = initAuth0({ ... });

export default auth0.withMiddlewareAuthRequired(async function middleware(req) {
const res = NextResponse.next();
const user = await auth0.getSession(req, res);
res.cookies.set('hl', user.language);
return res;
});
```

## Access an External API from an API Route

Get an access token by providing your API's audience and scopes. You can pass them directly to the `handlelogin` method, or use environment variables instead.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# @auth0/nextjs-auth0
# @auth0/nextjs-auth0 (Beta)

The Auth0 Next.js SDK is a library for implementing user authentication in Next.js applications.

> :warning: Please be aware that v2 is currently in [**Beta**](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages). Whilst we encourage you to test the update within your applications, we do no recommend using this version in production yet. Please follow the [migration guide](./V2_MIGRATION_GUIDE.md) when updating your application.
[![CircleCI](https://img.shields.io/circleci/build/github/auth0/nextjs-auth0/main?style=flat-square)](https://circleci.com/gh/auth0/nextjs-auth0/tree/main)
[![NPM version](https://img.shields.io/npm/v/@auth0/nextjs-auth0.svg?style=flat-square)](https://npmjs.org/package/@auth0/nextjs-auth0)
[![License](https://img.shields.io/:license-mit-blue.svg?style=flat)](https://opensource.org/licenses/MIT)
Expand Down Expand Up @@ -34,7 +36,7 @@ The Auth0 Next.js SDK is a library for implementing user authentication in Next.
Using [npm](https://npmjs.org):

```sh
npm install @auth0/nextjs-auth0
npm install @auth0/nextjs-auth0 --tag beta
```

This library supports the following tooling versions:
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/search.js

Large diffs are not rendered by default.

41 changes: 27 additions & 14 deletions docs/classes/frontend_use_user.requesterror.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ <h1>Class RequestError</h1>
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The error thrown by the user fetcher.</p>
<p>The error thrown by the default {@link UserFetcher}.</p>
</div>
<p>The <code>status</code> property contains the status code of the response. It is <code>0</code> when the request fails, e.g. due to being
offline.</p>
<p>This error is not thrown when the status code of the response is <code>401</code>, because that means the user is not
authenticated.</p>
<p>The <code>status</code> property contains the status code of the response. It is <code>0</code> when the request
fails, for example due to being offline.</p>
<p>This error is not thrown when the status code of the response is <code>204</code>, because that means the
user is not authenticated.</p>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
Expand Down Expand Up @@ -122,7 +122,7 @@ <h3>constructor</h3>
<aside class="tsd-sources">
<p>Overrides Error.constructor</p>
<ul>
<li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/cc75175/src/frontend/use-user.tsx#L46">src/frontend/use-user.tsx:46</a></li>
<li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/50cb3bd/src/frontend/use-user.tsx#L46">src/frontend/use-user.tsx:46</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -144,7 +144,7 @@ <h3>status</h3>
<div class="tsd-signature tsd-kind-icon">status<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/cc75175/src/frontend/use-user.tsx#L46">src/frontend/use-user.tsx:46</a></li>
<li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/50cb3bd/src/frontend/use-user.tsx#L46">src/frontend/use-user.tsx:46</a></li>
</ul>
</aside>
</section>
Expand Down Expand Up @@ -190,17 +190,23 @@ <h3>status</h3>
<a href="../modules/helpers.html">helpers</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/helpers_get_server_side_props_wrapper.html">helpers/get-<wbr>server-<wbr>side-<wbr>props-<wbr>wrapper</a>
<a href="../modules/helpers_testing.html">helpers/testing</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/helpers_with_api_auth_required.html">helpers/with-<wbr>api-<wbr>auth-<wbr>required</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/helpers_with_middleware_auth_required.html">helpers/with-<wbr>middleware-<wbr>auth-<wbr>required</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/helpers_with_page_auth_required.html">helpers/with-<wbr>page-<wbr>auth-<wbr>required</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/instance.html">instance</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/middleware.html">middleware</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/session.html">session</a>
</li>
Expand All @@ -213,6 +219,9 @@ <h3>status</h3>
<li class=" tsd-kind-module">
<a href="../modules/session_session.html">session/session</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/session_update_session.html">session/update-<wbr>session</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/utils_errors.html">utils/errors</a>
</li>
Expand Down Expand Up @@ -241,9 +250,6 @@ <h3>status</h3>
<li class=" tsd-kind-interface tsd-parent-kind-module">
<a href="../interfaces/frontend_use_user.userprofile.html" class="tsd-kind-icon">User<wbr>Profile</a>
</li>
<li class=" tsd-kind-type-alias tsd-parent-kind-module">
<a href="../modules/frontend_use_user.html#useuser" class="tsd-kind-icon">Use<wbr>User</a>
</li>
<li class=" tsd-kind-type-alias tsd-parent-kind-module">
<a href="../modules/frontend_use_user.html#usercontext" class="tsd-kind-icon">User<wbr>Context</a>
</li>
Expand All @@ -256,6 +262,9 @@ <h3>status</h3>
<li class=" tsd-kind-property tsd-parent-kind-module">
<a href="../modules/frontend_use_user.html#default" class="tsd-kind-icon">default</a>
</li>
<li class=" tsd-kind-function tsd-parent-kind-module">
<a href="../modules/frontend_use_user.html#useuser" class="tsd-kind-icon">use<wbr>User</a>
</li>
</ul>
</nav>
</div>
Expand All @@ -265,15 +274,19 @@ <h3>status</h3>
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
<li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
Expand Down
Loading

0 comments on commit abf36aa

Please sign in to comment.