ServiceStack IAuthSession is empty after authentication with FacebookAuthProvider

I try to get user data through IAuthSession after performing authentication using facebook, when I try to get a user with Request.GetSession (true) , which returns AuthUserSession (implements IAuthSession) I get a partial subset of the data, for example the following:

IAuthSession

I am trying to use it in a service method

[ClientCanSwapTemplates] [DefaultView("dashboard")] public DashboardResponse Get(FacebookRequest userRequest) { var user1 = Request.GetSession(true); return new DashboardResponse(); } 

I added auth providers to my apphost as follows:

  Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { new FacebookAuthProvider(appSettings), new TwitterAuthProvider(appSettings), new BasicAuthProvider(appSettings), new GoogleOpenIdOAuthProvider(appSettings), new LinkedInAuthProvider(appSettings), new CredentialsAuthProvider() })); 

As far as I know, facebookAuthProvider should populate IAuthSession with the following information:

 userSession.FacebookUserId = tokens.UserId ?? userSession.FacebookUserId; userSession.FacebookUserName = tokens.UserName ?? userSession.FacebookUserName; userSession.DisplayName = tokens.DisplayName ?? userSession.DisplayName; userSession.FirstName = tokens.FirstName ?? userSession.FirstName; userSession.LastName = tokens.LastName ?? userSession.LastName; userSession.PrimaryEmail = tokens.Email ?? userSession.PrimaryEmail ?? userSession.Email; 

which step am i missing?

+1
source share
1 answer

I was in a similar situation like, based on the answer I decided to try, and it worked.

The only difference is that I am using a simple injector, and you should consider registering this dependency as Singleton. An easier way for me to have this is registered:

 simpleInjectorContainer.RegisterSingle<ICacheClient>(()=>new MemoryCacheClient()); 
+2
source

All Articles