# How do I add a default role & permissions to a user?

**URL:** <https://community.auth0.com/t/how-do-i-add-a-default-role-permissions-to-a-user/43269>\
**Category:** Get Help\
**Tags:** rules, rbac\
**Created:** [May 19, 2020, 2:52pm UTC](https://community.auth0.com/t/how-do-i-add-a-default-role-permissions-to-a-user/43269 "2020-05-19T14:52:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maennchen](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/maennchen/32/21380_2.png) [@maennchen](https://community.auth0.com/u/maennchen)\
**Post date:** [May 19, 2020, 2:52pm UTC](https://community.auth0.com/t/how-do-i-add-a-default-role-permissions-to-a-user/43269/1 "2020-05-19T14:52:51Z")

</div>

Continuing the discussion from [How do I add a default role to a new user on first login?](http://community.auth0.com/t/how-do-i-add-a-default-role-to-a-new-user-on-first-login/25857):

Following this discussion, I implemented the rule to add the default role.

This will however only add the granted permissions when the user logs in a second time.

How can I make sure that the user gets his role & permissions even in the first logins token?

---

<div class="post-metadata">

**Author:** ![timwebflight.nl](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/timwebflight.nl/32/15515_2.png) [@timwebflight.nl](https://community.auth0.com/u/timwebflight.nl)\
**Post date:** [June 10, 2020, 4:40pm UTC](https://community.auth0.com/t/how-do-i-add-a-default-role-permissions-to-a-user/43269/2 "2020-06-10T16:40:54Z")

</div>

I have the same problem. Have you found a solution yet?

---

<div class="post-metadata">

**Author:** ![maennchen](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/maennchen/32/21380_2.png) [@maennchen](https://community.auth0.com/u/maennchen)\
**Post date:** [June 10, 2020, 4:47pm UTC](https://community.auth0.com/t/how-do-i-add-a-default-role-permissions-to-a-user/43269/3 "2020-06-10T16:47:46Z")

</div>

I’ve found an ugly hack, but not really a solution: The client has to immediately refresh on first login. The second token will be correct.

---

<div class="post-metadata">

**Author:** ![gil.edelman](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gil.edelman/32/11462_2.png) [@gil.edelman](https://community.auth0.com/u/gil.edelman)\
**Post date:** [January 19, 2021, 1:51am UTC](https://community.auth0.com/t/how-do-i-add-a-default-role-permissions-to-a-user/43269/4 "2021-01-19T01:51:28Z")

</div>

I’m also looking for a solution that will include the permissions in the access token on first login without forcing the client to refresh the access token. @dan.woda Are you able to assist and update the [FAQ](https://community.auth0.com/t/how-do-i-add-a-default-role-to-a-new-user-on-first-login/25857)?

There are several threads on this topic with no clear answer:

> [@Add roles to user in Custom database migration](https://community.auth0.com/t/add-roles-to-user-in-custom-database-migration/35885):
>
> Hi, I implemented a Login script that retrieves from a legacy database all the information related to users (name, email…), including Roles. I would like to assign those Roles to the user in the moment it is migrated, so when the Token is generated it will include the permissions for the predefined Role. Can I assign the Roles on the Login Script? If so, can you provide an example. If it is not possible. What other option do I have to accomplish this? Thanks,

> [@How to add roles, permissions to a user during signup?](https://community.auth0.com/t/how-to-add-roles-permissions-to-a-user-during-signup/27006):
>
> I have an application whose end users I like to store in Auth0 “Database” connection. I want to have end users credentials (username + password) to authenticate them with Auth0. On Successful login, I want Auth0 to return an id\_token which has a user role, permissions. Also, I want to know how I can I set these roles and permissions when a user signsup?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 19, 2021, 5:23pm UTC](https://community.auth0.com/t/how-do-i-add-a-default-role-permissions-to-a-user/43269/5 "2021-01-19T17:23:17Z")

</div>

@gil.edelman,

> [@gil.edelman](#):
>
> I’m also looking for a solution that will include the permissions in the access token on first login without forcing the client to refresh the access token.

You will have to force a token refresh on first login to get the role’s permissions in the AT. You should be able to do this silently without the user providing credentials.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 3, 2021, 5:23pm UTC](https://community.auth0.com/t/how-do-i-add-a-default-role-permissions-to-a-user/43269/6 "2021-02-03T17:23:21Z")

</div>

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