@webiny/api-security-auth0
TypeScript icon, indicating that this package has built-in type declarations

5.42.3 • Public • Published

@webiny/api-security-auth0

code style: prettier PRs Welcome

In .env file, add your Auth0 variables:

# Auth0 variables for the API.
AUTH0_DOMAIN=https://dev-12345678.us.auth0.com
AUTH0_CLIENT_ID=111111111111111

# Auth0 variables for React apps (webpack will pick this up).
REACT_APP_AUTH0_DOMAIN=https://dev-12345678.us.auth0.com
REACT_APP_AUTH0_CLIENT_ID=111111111111111

Auth0 Action to add custom claims:

/**
 * Handler that will be called during the execution of a PostLogin flow.
 *
 * @param {Event} event - Details about the user and the context in which they are logging in.
 * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
 */
exports.onExecutePostLogin = async (event, api) => {
  if (event.authorization) {
    api.idToken.setCustomClaim(`webiny_group`, event.user.app_metadata.group);
  }
};

Readme

Keywords

none

Package Sidebar

Install

npm i @webiny/api-security-auth0

Weekly Downloads

111

Version

5.42.3

License

Webiny Enterprise

Unpacked Size

31.1 kB

Total Files

21

Last publish

Collaborators

  • webiny