Logo-amall

Hello there, Another problem here... I would like to sign up user from React front end, and I would like to give him a role like "editor", when I run function: ``` signUpEmailPassword(email, password, { defaultRole: "editor", allowedRoles: ["editor", "me", "user"], }); ``` Even after adding the "editor" role to auth.roles table and adding ENV variable to auth service in docker-compose ``` ALLOWED_USER_ROLES: "editor, user, me" ``` I get response ``` "options.defaultRole" must be one of [me, user] ``` How can I change it? Thanks a lot

Last active 2 months ago

10 replies

9 views

  • OS

    Hello there,
    Another problem here…
    I would like to sign up user from React front end, and I would like to give him a role like "editor", when I run function:

     signUpEmailPassword(email, password, {
          defaultRole: "editor",
          allowedRoles: ["editor", "me", "user"],
        });
    

    Even after adding the "editor" role to auth.roles table and adding ENV variable to auth service in docker-compose

    ALLOWED_USER_ROLES: "editor, user, me"
    

    I get response

    "options.defaultRole" must be one of [me, user]
    

    How can I change it?

    Thanks a lot

  • EL

    I think the env var is named differently

  • EL

    like AUTHDEFAULTALLOWEDUSERROLES or something

  • OS

    Ah, right…

  • OS

    There is AUTH_USER_DEFAULT_ALLOWED_ROLES
    I just thought "default is when nothing else is provided… bit misleading here.
    But works, Thank you

  • EL

    no worries

  • OS

    … and there is no need to add rolels to auth.roles table… they are created from the AUTH_USER_DEFAULT_ALLOWED_ROLES variable
    👍 👍 👍

  • JW

    Hey! Im currently having the same problem but not sure where to define the 'AUTHUSERDEFAULTALLOWEDROLES' variable locally. Can you point me to the docs where this is explained for local development? 🙂 Also, what are the steps to mirror this for my hosted nhost project to sync between local and cloud?

  • GU

    If you are using either Nhost cloud & the CLI for development with the local dashboard, you should be able to go to the Settings page and Roles and Permissions, adding a new role to that section will effectively modify AUTH_USER_DEFAULT_ALLOWED_ROLES

  • JW

    I already did that for nhost cloud but the Settings page is disabled for the local dashboard

Last active 2 months ago

10 replies

9 views