You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@hortigado If I understand your comment, you are suggesting creating my own custom class? I can't see that table in the server_pod docs or the source code.
If you are suggesting adding my own custom class - that is what I've done.
The ask is really around including more of the standard OIDC / user info parameters provided by the auth provider (e.g. firebase) as out of the box features in the UserInfo class. I can add my own custom class for this - but then I have to link it with the UserInfo class. All quite possible - but not as convenient. Unless I am missing what you are suggesting.
Perhaps a better solution is to allow the UserInfo class to be generated/extended by the developer? But then you'd have to integrate that with the auth modules...
This isn't a show stopper - more of a paper cut - which is why it's a feature request (not a bug..)
Is serverpod_user_info meant to be developer customizable or reference-able?
That would be great, as every app will want to customize the user table fields. Would be nice to have standard way/docs to create our own User class that can extend serverpod's UserInfo. And of course the ability to use that User class in all auth methods/endpoints/backend functions. (Possibly an extends: UserInfo line in the protocol yaml?)
I'm trying to do the following, and can't, because serverpod generate gives the following error (yes, I did add tables_serverpod_auth.pgsql -- as renamed -- to my project, and the tables do exist in my Postgres DB):
Knew I had seen this earlier looking through serverpod code, but had to dig for it again. Deserves a doc addition, maybe I'll do a PR.
This is related to this topic because of frequent need to reference the user info in apps.
To get this to work (reference the user_info table as well as the UserInfo serializable model), it seems I do not need to add an extraClasses entry in generator.yaml. But since serverpod_auth has nickname: auth, specifying the "fully qualified" class as module:auth:UserInfo? as follows in the protocol generated a protocol file that included the serverpod_auth_server module and compiled properly:
class: Favoritetable: favoritefields:
userId: int # FK defined in user_info_favorite.pgsqluser: module:auth:UserInfo?, api
...
With the new Firebase provider, you receive the optional phone data through the callback, which allows to store the data in a custom class that has a relation to the AuthUser. Since the recommended pattern is to extend the UserProfile through relations, I'll close this one as not planned.
Activity
hortigado commentedon Mar 13, 2023
Friend it exist. you can modify the user class
wstrange commentedon Mar 13, 2023
@hortigado If I understand your comment, you are suggesting creating my own custom class? I can't see that table in the server_pod docs or the source code.
If you are suggesting adding my own custom class - that is what I've done.
The ask is really around including more of the standard OIDC / user info parameters provided by the auth provider (e.g. firebase) as out of the box features in the UserInfo class. I can add my own custom class for this - but then I have to link it with the UserInfo class. All quite possible - but not as convenient. Unless I am missing what you are suggesting.
Perhaps a better solution is to allow the UserInfo class to be generated/extended by the developer? But then you'd have to integrate that with the auth modules...
This isn't a show stopper - more of a paper cut - which is why it's a feature request (not a bug..)
vlidholt commentedon Mar 20, 2023
I think this could be a useful addition, especially for implementing 2fa.
tgrushka commentedon May 13, 2023
Is
serverpod_user_infomeant to be developer customizable or reference-able?That would be great, as every app will want to customize the user table fields. Would be nice to have standard way/docs to create our own
Userclass that canextendserverpod'sUserInfo. And of course the ability to use thatUserclass in all auth methods/endpoints/backend functions. (Possibly anextends: UserInfoline in the protocol yaml?)I'm trying to do the following, and can't, because
serverpod generategives the following error (yes, I did add tables_serverpod_auth.pgsql -- as renamed -- to my project, and the tables do exist in my Postgres DB):serverpod generate...
FormatException: The table "playlist" (class "Playlist" is referencing a table that doesn't exist (serverpod_user_info).)BTW, it is also added to my
my_server/config/generator.yamland all of mypubspec.yamls:tgrushka commentedon May 13, 2023
And I'm thinking adding this
playlist_serverpod_user_info_fk.pgsqlmight work, but perhaps a bit cumbersome:tgrushka commentedon May 14, 2023
Knew I had seen this earlier looking through serverpod code, but had to dig for it again. Deserves a doc addition, maybe I'll do a PR.
This is related to this topic because of frequent need to reference the user info in apps.
To get this to work (reference the
user_infotable as well as theUserInfoserializable model), it seems I do not need to add anextraClassesentry in generator.yaml. But sinceserverpod_authhasnickname: auth, specifying the "fully qualified" class asmodule:auth:UserInfo?as follows in the protocol generated a protocol file that included theserverpod_auth_servermodule and compiled properly:tgrushka commentedon May 14, 2023
Oh, found it: https://docs.serverpod.dev/concepts/modules#referencing-a-module
edzzn commentedon Jun 17, 2024
I was looking for this, I think that the documentation can be more explicit about doing this. This is very common.
marcelomendoncasoares commentedon Apr 3, 2026
With the new Firebase provider, you receive the optional phone data through the callback, which allows to store the data in a custom class that has a relation to the
AuthUser. Since the recommended pattern is to extend theUserProfilethrough relations, I'll close this one as not planned.