我在codeigniter中构建了一个简单的url缩短应用程序,允许用户通过facebook登录。
首次授权时,在允许Facebook权限后返回服务器错误。
我已将问题缩小到我的路线文件或我的htaccess。但无论我尝试什么,我都无法工作。
由于app是网址缩短器,因此未指定的任何路由都采用默认路由。像这样......
$route['login'] = "auth/login";
$route['about'] = "pages/about";
$route['(:any)'] = "redirect/index/$1";
我认为这就是为什么它没有认证。我试着这样做:
$route['auth_social/(:any)'] = "auth_social/$1";
也没有用。我唯一能让它发挥作用的是我将.htaccess改为
RewriteEngine on
RewriteCond $1 !^(index\.php|images|table-images|js|robots\.txt|css|captcha)
RewriteRule ^(.*)$ /index.php/$1 [L]
然后我的网址缩短打破了,不起作用。这让我发疯了。
有人能看到我在哪里错了吗?
这是我的完整.htaccess文件
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
编辑:
以下是服务器日志中的错误:
[10-Jan-2013 11:02:25 UTC] PHP Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user.
thrown in /Users/mycomputer/Documents/grpe/app/application/libraries/facebook/base_facebook.php on line 1058
答案 0 :(得分:0)
您使用的oAuth库是什么?
我强烈建议使用这个oAuth2 sparks库:
http://getsparks.org/packages/oauth2/versions/HEAD/show
我一直在使用它一段时间没有任何问题登录/注册。
HTH