我在尝试通过IAuthSession获取用户数据后,我尝试通过 Request.GetSession(true)获取用户,返回AuthUserSession(实现IAuthSession)I获取部分数据子集,如下所示:
我正在尝试在服务方法中使用它
[ClientCanSwapTemplates]
[DefaultView("dashboard")]
public DashboardResponse Get(FacebookRequest userRequest)
{
var user1 = Request.GetSession(true);
return new DashboardResponse();
}
我已经添加了auth提供程序我的apphost,如下所示:
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()
}));
据我所知facebookAuthProvider应该在IAuthSession中填写以下信息:
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;
我错过了哪一步?