0

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]

しかし、その後、私のURL短縮サービスが壊れて、機能しなくなります。それは私を夢中にさせています。

誰かが私がここで間違っているところを見ることができますか?

これが私の完全な.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
4

1 に答える 1

0

どの oAuth ライブラリを使用していますか?

この oAuth2 sparks ライブラリを使用することを強くお勧めします:
http://getsparks.org/packages/oauth2/versions/HEAD/show

ログイン/サインアップにまったく問題なく、しばらく使用しています。

HTH

于 2013-01-10T13:55:04.953 に答える