vue-auth: Roles Check seems to be broken with arrays?

Hi.

I’ve been wondering around and I can’t really understand why the h*ll I get false when I run $auth.check(4) in my component. It doesn’t matter if I do it with a string $auth.check('4') if I do $auth.user() I get the following output

{
  "businessUnits": [
    {
      "Id": 99,
      "Name": "Example Ltd"
    }
  ],
  "detailedRoles": [
    {
      "Id": 4,
      "Name": "user"
    }
  ],
  "exp": 1480883709,
  "name": "firstname.lastname",
  "roles": [
    4
  ]
}

My init of VueAuth looks like this, I guess the rolesVar isn’t necessary since I use the standard.

Vue.use(VueAuth, {
  router: router,
  authRedirect: {path: '/'},
  loginData: {'method': 'GET'},
  rolesVar: 'roles',
  tokenExpired: () => {
    return false
  }
})

Any clues why the heck I can’t do $auth.check(4) and get true

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (15 by maintainers)

Most upvoted comments

@websanova When I try to use the latest 2.1.0-beta I get the error I added utils.js?92c3:3 Uncaught RangeError: Maximum call stack size exceeded(…)

That is referring to in the utils.js file

    function isObject(val) {
        if (val !== null && typeof val === 'object' && val.constructor !== Array ) {
            return true;
        }

        return false;
    }

Which is the stable version of vue-auth, I tried to change it to use 2.1.0. But that resulted in: utils.js?92c3:3 Uncaught RangeError: Maximum call stack size exceeded(…)