Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata from User #82

Open
rickyking opened this issue Feb 11, 2021 · 1 comment
Open

Metadata from User #82

rickyking opened this issue Feb 11, 2021 · 1 comment

Comments

@rickyking
Copy link

Hi,

Thanks for this great package!

Do you think it's possible to easily obtain the metadata from auth0?

image
image

that would be great to help me control the app content display.

@cwilligv
Copy link

Hi @rickyking ,

I know it's been a while since you posted this question, however, I wanted to contribute to the answer for everyone's benefit. Today, this can be done via Actions and previously this was done via Rules (javascript functions).

The steps to append metadata into the user info response once the user logs in are:

  1. add the following two parameters under the user metadata section in Auth0: name and address
  2. create custom action from the library menu, let's call it Add metadata
  3. Use setCustomClaim to retrieve user_matadata and append it to user info
exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://myapp.com';

  api.idToken.setCustomClaim(
    `${namespace}/name`,
    event.user.user_metadata.name
  );
  
  api.idToken.setCustomClaim(
    `${namespace}/address`,
    event.user.user_metadata.address
  );
};
  1. Deploy the action
  2. Attach the action to the login flow (see this link for more info)

After all the steps you should have the user metadata coming in the auth0_info object in shiny.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants