大家好我使用facebook c#sdk 5.0.50来获取网络应用程序中的Facebook帐户的电子邮件和名称,但FacebookWebContext.Current.IsAuthenticated始终返回false,fbWebContext.UserId始终为0(零)如果我登录Facebook。
我已经使用AppId和AppSecret配置了我的web.config。我还将Facebook.dll和Facebook.Web.dll复制到我的Bin文件夹中。我使用Facebook Javascript SDK来做日志记录部分。有什么东西我不见了吗?
这是我的代码
记录部分:
FB.login(function (response) {
if (response.authResponse) {
FB.api('/me', function (response) {
console.log('Good to see you, ' + response.name + '.');
window.location.reload();
});
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, { scope: 'email,user_birthday' });
在Im后面的代码中使用以下代码:
If fbWebContext.IsAuthenticated Then
Dim fb = New FacebookWebClient(fbWebContext)
Dim meInfo = CType(fb.Get("me"), Dictionary(Of String, Object))
Dim firstName As String = meInfo("first_name")
Dim lastName As String = meInfo("last_name")
Dim email As String = meInfo("email")
Mensaje.Text = String.Concat("code: ", firstName)
Else
Mensaje.Text = "not authorized - " & fbWebContext.Settings.AppId & " -" & fbWebContext.Settings.AppSecret
End If
我可以使用Facebook Javascript SDK显示信息,但我需要在服务器中执行此操作,因为在我获得用户后我需要处理它以查看他是否在我们的数据库中
请帮忙 提前致谢