Authentification custom providers await session.scopes empty
#2119
-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I got this issue too |
Beta Was this translation helpful? Give feedback.
-
@SalahAnwer try pass this param in siginin methode |
Beta Was this translation helpful? Give feedback.
-
You might have already resolved this but I'll answer here just to give some clarification if anyone else runs into this issue. Unfortunately, there exists some confusion around where the scopes should be registered as there is both a field in the User model and in the AuthKey model. The correct way to register scopes for a user is, as @ihebmeftah has already mentioned, in the call The scopes registered in the call to that method are the scopes that will be reflected in the session object in the endpoint.
We recently updated our documentation around implementing a custom provider, and this section discusses this specific topic: https://docs.serverpod.dev/concepts/authentication/providers/custom-providers#create-auth-token. EDIT: |
Beta Was this translation helpful? Give feedback.
@SalahAnwer try pass this param in siginin methode
.signInUser(userInfo.id!, 'myAuthMethod', scopes: userInfo.scopes)
this is my example https://github.com/ihebmeftah/dart-serverside/blob/master/lms_server/lib/src/endpoints/users_endpoint.dart