Skip to content

Integrates authorization mechanisms provided by nextjs-auth0 into Kurier.

License

Notifications You must be signed in to change notification settings

kurierjs/kurier-addon-nextjs-auth0

Repository files navigation

@kurier/addon-nextjs-auth0

Integrates authorization mechanisms provided by @auth0/nextjs-auth0 into Kurier.

Requirements

  • kurier@^1.2.0-alpha3

Usage

Install it using npm or yarn:

$ npm i -D @kurier/addon-nextjs-auth0
$ yarn add -D @kurier/addon-nextjs-auth0

Add it to your Kurier app in Next.js and expose the protected API via Vercel:

import NextJSAuth0Addon, { withProtectedKurierApi } from '@kurier/addon-nextjs-auth0';
import { jsonApiVercel } from 'kurier';

// ...

app.use(NextJSAuth0Addon, {
  getUserAttributes(user) {
    return {
      /* This will be injected into `user.attributes`.
         Be sure to add `roles` and/or `permissions` to take advantage
         of Kurier's authorization decorators. */
      roles: user.roles,
    }
  }
}

// ...

export default withProtectedKurierApi(jsonApiVercel, app);

About

Integrates authorization mechanisms provided by nextjs-auth0 into Kurier.

Resources

License

Stars

Watchers

Forks

Packages

No packages published