Skip to content

Disccussion about Permission #168

@tanedward2101

Description

@tanedward2101

Hi, need some help here.
My authentication feathers return this.

{
    "accessToken": "",
    "authentication": {
        "strategy": "local",
        "accessToken": "",
        "payload": {

        }
    },
    "user": {
        "id": 10,
        "username": "John Doe",
        "roles": [
            "administrator",
            "another-role"
        ],
    }
}

And this is my authClientOption

const authClientOptions = {
  storageKey: 'feathers-jwt', // The key in localStorage used to store the authentication token
  authenticate: { // Options included in calls to Feathers client.authenticate
    strategy: 'local',
  },
  permissionsKey: 'permissions', // The key in localStorage used to store permissions from decoded JWT
  permissionsField: 'roles', // The key in the decoded JWT containing the user's role
  passwordField: 'password', // The key used to provide the password to Feathers client.authenticate
  usernameField: 'username', // The key used to provide the username to Feathers client.authenticate
  redirectTo: '/login', // Redirect to this path if an AUTH_CHECK fails. Uses the react-admin default of '/login' if omitted.
  logoutOnForbidden: true
};

One user can have multiple roles. Is there anyway to get that roles data?
Somehow, I cannot retrieve roles data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions