次のセットアップを使用して最初にユーザーを認証し、次に認証情報を使用して次のリクエストを処理しています。
views.py から
@canvas_only
def authenticate(request):
request.session['access_token'] = request.facebook.graph.access_token
return render(request, 'authenticated.html', {})
class Home(View):
def get(self, request, *args, **kwargs):
"""The home to be called from within the application"""
access_token = request.session['access_token']
graph = facebook.GraphAPI(access_token)
me = graph.get_object('me')
request.session['my_id'] = me['id']
template_data = _collect_home_data(graph)
return render(request, 'home.html', template_data)
urls.py から:
urlpatterns = patterns('',
url(r'^$', 'crosswords.ugly.views.authenticate'),
url(r'^home/$', Home.as_view(), name='home'),
これはほとんど機能します (アプリ内のリンクは現在正常に機能しています) が、新しいユーザー (アプリを承認していない) には次のエラー メッセージが表示されます。
クロスワードでエラーが発生しました。後でもう一度やり直してください。
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration.
Facebookのアプリ設定(キャンバスURL、セキュアキャンバスURL)は両方とも
http(s)://finebitstrings.pythonanywhere.com/
そのエラーを取り除くにはどうすればよいですか?