Auth0 Home Blog Docs

Vue authentication custom fields

roles

#1

Hi all!

I’m struggling with the roles still.

I use the Vue tutorial for the single page apps the only part that looks like a request is:

auth0 = new auth0.WebAuth({
    domain: '__AUTH0_NAMESPACE__',
    clientID: '__AUTH0_CLIENT_ID__',
    redirectUri: 'http://localhost:3000/callback',
    audience: 'https://__AUTH0_NAMESPACE__/userinfo',
    responseType: 'token id_token',
    scope: 'openid',
    roles: 'admin
  })

So I’ve added the " roles: ‘admin’ " to the end of it, that doesn’t work.

Where and how can I add custom fields when I authorising the user using Vue single page app?


#2

depending on how you want to add roles to users you can use a Rule to accomplish this, here is an example: https://auth0.com/rules/roles-creation


#3

Thank you, that example works well.

The point is I want to make rule depends on a custom parameter sent with the authorization request.