How to reference Custom namespaced id token fields

I have created some custom ID tokens to the auth0 standard of using a namespace such as ‘http://www.test.com/roles’ and assigned an array of roles (strings) to the said idtoken.

Problem is I am now in vuejs/javascript, I have received my id token but how do I reference a variable with the name ‘http://www.test.com/roles’ as the second I reference user.http://www.test.com/roles I get an error because of the ‘:’ colon in the variable name and the 2 slashes are being treated as comments.

this.$parent.$parent.user.http://www.stutor.com/roles is erroring out due to the colon and the slashes in the variable name.

Please help!!!
Thanks

Hi @wolfbrownie1995,

You’ll need to use the bracket notation instead of dot notation when the key is a URL like that

e.g.
user["http://www.stutor.com/roles"]

Some more example are here: JSON Literals

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