Closed Bouni closed 10 months ago
@Bouni we are not joining Group table when fetching for user for authentication. But this is supposed to be lazy loaded though. Have you checked if the user belongs to a group?
@Bouni whats the version ninja-jwt are you on?
I ran your code and I got this. I think your user is not assigned to a group
{
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTcwNTA3MzM3OCwiaWF0IjoxNzA0OTg2OTc4LCJqdGkiOiI5MWM4MWQyYmU0MmQ0YjI4OWM0ZWUwMGI0NzhkZGVkMyIsInVzZXJfaWQiOjF9.y-Z2kk5nHfGcPxixI3WgNNLwCW9EcY2LVgJ3pxuWfmk",
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzA0OTg3Mjc4LCJpYXQiOjE3MDQ5ODY5NzgsImp0aSI6IjExYjA4OWM0YWI1NjRhNThhMjBkM2Y5MGVkN2M1NjFmIiwidXNlcl9pZCI6MX0.SLT4YbmdLtzmx4zcrcxH9hKnN08TohM-eB4whDVCSCk",
"user": {
"first_name": "",
"last_name": "",
"username": "person.username_1",
"email": "person1@gmail.com",
"groups": [
{
"name": "client"
},
{
"name": "group1"
}
]
}
}
🤔 I have to check tomorrow. I'm almost sure I created a group and assigned the user but I might have missed something
@eadwinCode I'm such an idiot and you were absolutely right. I prepared the group but did not assign it to the user 😅
@Bouni You are not an idiot😅... Its just a human error... It happens
How can I get the groups of a user when getting the TokenPair?
This is what I tried but I get an empty groups list as result for
user = UserSchema.from_orm(self._user)