Accessing user_metadata by sdk without populating id token

Hi!
I am wondering if there is a way to access/read and possibly even write (add field) to user_metadata by just using a frontend sdk (auth0-spa-js, or other), without populating id token. So I would like to get user_metadata in spa without calling backend api and without increasing the size of the id token.

Thank you!

Hi @tomaz.jejcic,

Welcome to the Auth0 Community!

I’m afraid what you seek is not possible. You will need to choose between calling the Management API to get the user’s user_metadata or read the user_metadata in the ID Token.

Since the ID Token does not contain any information regarding the user’s user_metadata by default, you will need to append these values as a custom claim. When doing so, you will increase the size of the ID token. And unfortunately, this is unavoidable.

Given that, I strongly encourage you to decide on one of the two methods. There isn’t an alternative way to retrieve the user’s user_metadata.

I hope that helps!

Please let me know if you have any further questions.

Thank you.

1 Like

Thank you for the swift reply and confirming my suspicion.

1 Like

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