【发布时间】:2015-07-13 09:28:22
【问题描述】:
我正在使用 servicestack,在客户端,我有 facebook 身份验证,这将提供一个 accesstoken 帖子登录
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Successful login for: ' + response.name);
document.getElementById('status').innerHTML =
'Thanks for logging in, ' + response.name + '!';
});
}
身份验证完成后,会设置一个 cookie 值 fbsr_Appid,其中将包含身份验证令牌
当用户向 servicestack 发出请求时,我将能够从上下文中的 cookie 值中获取此身份验证令牌。 那么现在,我如何使用此令牌获取用户的用户 ID/电子邮件 ID?
目前我可以使用下面的 url 获取访问令牌的到期时间
https://graph.facebook.com/oauth/access_token_info?client_id=APPID&access_token=xxxxxxxxx
返回以下格式的响应
{
access_token: "xxxxxxxx",
token_type: "bearer",
expires_in: 5560
}
【问题讨论】:
标签: javascript c# facebook authentication servicestack