获取登录用户的帖子列表

时间:2019-02-27 22:22:28

标签: facebook facebook-javascript-sdk facebook-sdk-4.0

我已使用Facebook JavaScript SDK登录,然后致电:

# BMAServer Web Server Configuration created by MCCI/Chuck Mason on 2/13/2019
#LoadModule ibm_ssl_module /QSYS.LIB/QHTTPSVR.LIB/QZSRVSSL.SRVPGM

LoadModule zend_enabler_module /QSYS.LIB/QHTTPSVR.LIB/QZFAST.SRVPGM

Listen *:85

DocumentRoot /www/bmaserver/htdocs
TraceEnable Off

Options +Indexes +FollowSymLinks +ExecCGI

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{Cookie}n \"%r\" %t" cookie
LogFormat "%{User-agent}i" agent
LogFormat "%{Referer}i -> %U" referer
LogFormat "%h %l %u %t \"%r\" %>s %b" common

CustomLog logs/access_log combined
LogMaint logs/access_log 3 0
LogMaint logs/error_log 3 0

ServerName BMAserver

SetEnvIf "User-Agent" "Mozilla/2" nokeepalive
SetEnvIf "User-Agent" "JDK/1\.0" force-response-1.0
SetEnvIf "User-Agent" "Java/1\.0" force-response-1.0
SetEnvIf "User-Agent" "RealPlayer 4\.0" force-response-1.0
SetEnvIf "User-Agent" "MSIE 4\.0b2;" nokeepalive
SetEnvIf "User-Agent" "MSIE 4\.0b2;" force-response-1.0

DirectoryIndex menu.php

CgiConvMode %%MIXED/MIXED%%
#TimeOut 30000
KeepAlive Off
HotBackup Off

DefaultFsCCSID 37
CGIJobCCSID 37

AccessFileName .htaccess
AddCharset UTF-8 .htm .html

# zend fastcgi
# Directive name "FastCgiConfig" is not recognized. (argh)
AddType application/x-httpd-php .php
AddHandler fastcgi-script .php

RewriteEngine on

<Location *>
  <LimitExcept GET HEAD OPTIONS TRACE POST>
     Order Allow,Deny
     Deny From All
  </LimitExcept>
</Location>

<Location />
  Require valid-user
  AuthType Basic
  AuthName MHBAServer
  PasswdFile %%SYSTEM%%
  UserID %%CLIENT%%
</Location>

<Directory />
  Order Deny,Allow
  Deny From all
</Directory>

# Allow requests for files in document root
<Directory /www/bmaserver/htdocs>
  Options +FollowSymLinks +ExecCGI
  AddHandler cgi-script .py
  Order Allow,Deny
  Allow From all
  AllowOverride all
</Directory>

# Allow requests for OutQueue
<Directory /www/bmaserver/OutQueue>
  Order Allow,Deny
  Allow From all
</Directory>

AliasMatch ^/htdocs/(.*) /www/bmaserver/htdocs/$1
AliasMatch ^/OutQueue/(.*) /www/bmaserver/OutQueue/$1

我收到此回复:

enter image description here

有人知道为什么我没有数据吗?我知道,过去48个小时我已经发布了很多次,这并不是因为缺少帖子。也许我需要给我的应用更多权限,以访问developer.facebook.com?

1 个答案:

答案 0 :(得分:0)

此权限的必要权限为user_posts,请确保您在登录过程中授权了该权限。此外,该API调用将只获得一些默认值,您需要可以指定要获取的字段,而无需在URL中添加访问令牌。这样会更好:

FB.api(
    '/me/feed',
    {
        access_token: accessToken,
        fields: 'message',
        limit:50
    },
    (response) => {
        console.log(response);
    }
);

关于可能的字段,只需查看Posts的API参考即可。