Auth0 Home Blog Docs

Symfony not receiving user Roles

roles
symfony
user

#1

I have created a Symfony application that uses the Auth0 to authenticate, I have got the ability to log a user into the application, and they can access the secured areas allowed to ROLE_OAUTH_USER, but I can’t seem to get the user roles stored in the app_metadata to allow access to ROLE_SUPER areas.

I have used the Auth0 tester to show the user data and this is the result (I have removed sensitive info):

{
  "email": "REMOVED",
  "username": "REMOVED",
  "picture": "REMOVED",
  "nickname": "REMOVED",
  "name": "REMOVED",
  "user_metadata": {},
  "app_metadata": {
    "admin_level": "superadmin",
    "roles": 
      "ROLE_SUPER"
    ]
  },
  "admin_level": "superadmin",
  "email_verified": true,
  "user_id": "REMOVED",
  "clientID": "REMOVED",
  "identities": 
    {
      "user_id": "REMOVED",
      "provider": "auth0",
      "connection": "Username-Password-Authentication",
      "isSocial": false
    }
  ],
  "updated_at": "2018-01-24T06:51:24.969Z",
  "created_at": "2018-01-19T12:50:14.665Z",
  "roles": 
    "ROLE_SUPER"
  ],
  "sub": "REMOVED"
}

The only roles that are showing for this or any other user on Symfony is ROLE_USER and ROLE_OAUTH_USER

It’s probably something silly, or I’m missing a step, any help would be appreciated :slight_smile: