有谁知道如何使用javascript sdk获取facebook用户的缩略图/头像?
我知道要获得完整尺寸的照片我可以做以下事情:
//Get a list of all the albums
FB.api('/me/albums', function (response) {
for (album in response.data) {
// Find the Profile Picture album
if (response.data[album].name == "Profile Pictures") {
// Get a list of all photos in that album.
FB.api(response.data[album].id + "/photos", function(response) {
//The image link
image = response.data[0].images[0].source;
});
}
}
});
Run Code Online (Sandbox Code Playgroud)
不确定如何获取缩略图/头像大小.像50x50大小的东西
我们使用Facebook Javascript SDK来验证我们的用户.
用户进行身份验证后,用户将获得包含已签名请求的fbsr_ <app_id> cookie.
然后我们使用AJAX将一些信息发布到我们的服务器.服务器接收带有签名请求的cookie,但是当服务器解析cookie中的签名请求(修改过的python SDK)时,它会将JSON对象解码为:
{
"algorithm": "HMAC-SHA256",
"code": "2.AQDBJ3-ZpURb9P4T.3600.1316037600.1-786359552|BNK6FGOAkvMs7slboQMSIEJYDWc",
"issued_at": 1316031333,
"user_id": "786359552"
}
这与我们应该获得的签名请求文档相反.
服务器需要访问令牌,因此可以使用GraphAPI获取一些其他信息.
我们如何从签名请求中获取访问令牌?
我有一个网站,允许通过Facebook功能登录,并显示Facebook的照片.
从移动浏览器访问时,如果用户已通过本机FB应用程序(iOS或andriod)登录,我希望网站自动登录(当点击FB登录按钮时,无需输入用户名和密码).似乎我可以通过构建原生iOS或Android应用程序并使用Facebook单点登录功能来做到这一点.没有用户在移动设备上安装任何东西,是否可以这样做?
我目前正在尝试使用android应用程序中的phonegap开发facebook登录功能.我已经完成了所有必要的安装,并为我放在facebook上的应用程序生成了一个哈希键,但是我一直收到以下错误:
应用程序配置不允许使用URL:应用程序的设置不允许使用一个或多个给定的URL.它必须与网站URL或Canvas URL匹配,或者域必须是App域之一的子域.
我已经看了下面的链接并完成了链接的建议,但我仍然在logcat控制台中遇到同样的错误
FB.login()似乎只有在点击事件触发时才有效.我希望它在页面加载时触发.我尝试过使用这种trigger()方法,但是没有用.我也试过用它来触发它jQuery('#button').click().
$(function(){
//this is logging so I know the js is loading properly
console.log("script loaded");
$('button').button();
$('#button').click(function(){
FB.login(function(response) {
console.log('FBLOGIN firing');
if(response.status === "connected"){
var uID = response.authResponse.userID;
FB.api('/me', function(response) {
var name = response.name;
if(response.location){
var response = response.location.name;
}else{
alert("The Bringer Network needs your current city to be set in your Facebook 'about' section. Please make it public for our use");
}
});//closes fb.api
}else if(response.status === "not_authorized"){
//authCancelled. redirect
}
},{scope: 'user_location,user_likes'}); …Run Code Online (Sandbox Code Playgroud) StackOverflow和Untappd这样的网站如何"强制"用户接受他们的权限?
当我尝试使用JavaScript SDK时,我一直在使用范围对象来请求电子邮件地址,但我一直看到"编辑您提供的信息",允许用户不提供他们的电子邮件地址.我甚至尝试过手动构建登录流程,结果相同.
图片:

由于我们允许用户通过Facebook在网站上注册,我们依赖于电子邮件地址在我们的数据库中创建一个帐户.
然而像StackOverflow和Untappd这样的网站没有提供这样的选项,我不得不接受这些权限.
那秘密是什么?我该如何实现这一目标?这是我在某个地方俯瞰的场景吗?还是需要"批准"?
任何人都可以帮助我理解为什么我在尝试使用 Facebook SDK 登录按钮时会收到此错误?
无效范围:manage_pages。此消息仅向开发人员显示。您的应用程序的用户将忽略这些权限(如果存在)。请阅读有效权限的文档:https : //developers.facebook.com/docs/facebook-login/permissions
这是 HTML:
<fb:login-button scope="manage_pages" onlogin="checkLoginState();"></fb:login-button>
Run Code Online (Sandbox Code Playgroud)
这是JS:
// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {
console.log('statusChangeCallback');
console.log(response);
window.facebook = {user_data: response};
// The response object is returned with a status field that lets the
// app know the current login status of the person.
// Full docs on the response object can be found in the documentation
// for FB.getLoginStatus().
if (response.status === 'connected') {
// Logged into …Run Code Online (Sandbox Code Playgroud) javascript facebook facebook-graph-api facebook-javascript-sdk
我通过从 facebook.com 生成的代码添加了Facebook 聊天插件
<!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- Your customer chat code -->
<div class="fb-customerchat"
attribution=setup_tool
page_id="124030157608968">
</div>`
Run Code Online (Sandbox Code Playgroud)
但是我在谷歌浏览器中运行了一个 Pagespeed 测试,结果是灾难性的。
任何建议如何解决这个问题?
非常感谢!
如何使用 facebook graph api 进行creativeid过滤Ads。
我尝试了下面的查询,但它不起作用。
act_xxxxxx/ads?fields=creative{id}&filtering=[{field: "creative",operator:"EQUAL", value:"id_of_creative"}]
act_xxxxxx/ads?fields=creative{id}&filtering=[{field: "ad.creative.id",operator:"EQUAL", value:"id_of_creative"}]
act_xxxxxx/ads?fields=creative{id}&filtering=[{field: "creative.id",operator:"EQUAL", value:"id_of_creative"}]
但对于以上所有反应是
{ "error": { "message": "(#100) Filtering field 'creative.' with operation 'equal' is not supported", "type": "OAuthException", "code": 100, "error_data": "An unknown error occurred", "fbtrace_id": "AlWsddsx" } }
我正在尝试将 Messenger 实时客户聊天插件动态添加到站点,方法是首先通过 API 将域列入白名单,然后将脚本标记注入白名单域站点。
现在,将脚本注入白名单站点后,它会失败并出现 CORS 错误。但是,如果我使用 UI 通过 Facebook 应用程序手动将 URL 列入白名单,则效果很好。我不明白为什么当文档明确表示它应该起作用时,通过 API 进行白名单却不起作用。
curl 'https://graph.facebook.com/v12.0/me/messenger_profile?access_token=EAxxxxxxxPr' \
-H 'authority: graph.facebook.com' \
-H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"' \
-H 'accept: application/json, text/plain, */*' \
-H 'content-type: application/json' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'origin: https://livechat.frangout.com' \
-H 'sec-fetch-site: cross-site' \
-H …Run Code Online (Sandbox Code Playgroud) javascript facebook facebook-graph-api facebook-javascript-sdk facebook-messenger