Store wordpress user role as user app_metadata

Hey all,

How would I go about storing a users wordpress role e.g. ‘Subscriber’ or ‘Customer’ in each Auth0 users app_metadata so that I can restrict content on my SPA to certain user roles.

Thanks in advance!

Hi @hillierliam37,

Welcome to the Auth0 Community Forum!

Have you checked out the management api? You should be able to do that!

Let me know if you run into any issues.

Thanks,
Dan

Hey @dan.woda,

Thanks for the above, i’ve managed to set it up. Just one issue.

Im using https://auth0.com/docs/cms/wordpress/extending[auth0_user_login](https://auth0.com/docs/cms/wordpress/extending), which gives me the wordpress user ID, but I need the auth0 user ID so that I can make a patch request to update the user.

Do you know how I can get the Auth0 ID of the user instead of the wordpress id whenever the user logs in?

EDITED:
Solved! Auth0 ID was saved in the $userinfo. Everything working perfectly!

Thanks!
Liam

Glad to hear you got it working!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.