我在codeigniter中构建了一个简单的url缩短应用程序,该应用程序还允许用户通过facebook登录。
第一次授权时,在允许facebook的权限后返回服务器错误。
我已经把问题缩小到我的路由文件或我的htaccess。但是,不管我怎么努力,我就是不能使它工作。
由于该应用是一个url缩短器,任何未指定的路由都会使用默认路由。像这样…
$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
您使用的是哪个oAuth库?
我强烈建议使用这个oAuth2火花库:
http://getsparks.org/packages/oauth2/versions/HEAD/show
我已经使用它一段时间了,登录/注册没有任何问题。
HTH