dsg435665475 2012-07-19 03:57
浏览 43
已采纳

Localhost facebook登录不适用于较低级别的URL

Thanks in advance for reading.

I've been working with facebook login (both php and javascript sdk methods) for a couple of years and I'm facing a particular problem with new apps I'm developing.

I have an app in my localhost configured as virtual directory as follows:

http://localhost/myapp/

On facebook, the following settings of my app are pointing to that url: App Domains, Facebook Login Website, App on Facebook (https and http) and Mobile Web.

When I do the login process and point the redirect_uri to http://localhost/myapp/, it works fine, the cookie is set and I can make queries to the graph api.

The problem comes when I try to use another redirect uri like http://localhost/myapp/user_controller/register (Adds the user to the database). Although it is inside the app url configured on facebook, the SDK outputs an error message (OAuthException | An active access token must be used to query information about the current user. | Code 2500).

I figured out that, to solve this problem for a while, I have to go to the facebook app page: apps.facebook.com/myapp. I have to do it everytime my access_token has expired and, since this app is not intended to be inside facebook, I don't think that this is the best way to solve this.

I hope together we can find a good way to solve this issue and this questions helps future developers.

I'm using CodeIgniter (which I've been using about a year) and Facebook PHP SDK (downloaded directly from the github official repo) as CI library.

Thanks again.

  • 写回答

1条回答 默认 最新

  • dongpu9481 2012-07-20 03:38
    关注

    At no point would you get that error during authentication.

    I'm pretty sure that you instead have an error in your code that fails to exchange the code for the access_token on the .../register endpoint, and so you end up using an invalid access_token.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 arduino控制ps2手柄一直报错
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥85 maple软件,solve求反函数,出现rootof怎么办?
  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题