Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getRoles() wont work with mongoDB #16

Open
Sithira opened this issue Jun 19, 2018 · 1 comment
Open

getRoles() wont work with mongoDB #16

Sithira opened this issue Jun 19, 2018 · 1 comment

Comments

@Sithira
Copy link

Sithira commented Jun 19, 2018

basically topic says it all.
what have i done so far is that

let user = await auth.getUser();
console.log(user.getRoles()) // user.getRoles is not a function....

but when i do

let user = await User.first();
console.log(user.getRoles())

above works. since it does not work with the auth method, it won't work on protected routes.

im using lucid-mongo

@Sithira
Copy link
Author

Sithira commented Jun 19, 2018

after digging into the core of the package, I' have found the issue. it's really confusing.
When i use

auth.getUser() // this wont get the roles associated to the user 

but when i use

User.find() // this returns the roles of the user. ( same user as the auth.getUser() ) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant