指定的URL不归应用程序所有

时间:2012-09-03 23:36:45

标签: facebook

我使用以下设置首先对用户进行身份验证,然后使用身份验证信息处理以下请求。

来自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(canvas url,secure canvas url)上的应用设置都指向

  

HTTP(S)://finebitstrings.pythonanywhere.com/

我可以做些什么来消除这个错误?

1 个答案:

答案 0 :(得分:5)

我已经在另一个问题中回答了这个问题,所以我要给你发贴链接:

Error 191 on Facebook, but URL is set up properly

尝试这些应用设置,也许可以解决它。在大多数情况下确实如此。