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

  • 本文关键字:应用程序 URL facebook
  • 更新时间 :
  • 英文 :


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

从视图.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'),

这基本上有效(应用程序中的链接现在可以正常工作),但新用户(尚未授权应用程序)会收到以下错误消息:

Crosswords出现错误。请稍后再试。

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://finebitstrings.pythonanywhere.com/

我能做些什么来消除那个错误?

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

Facebook上出现错误191,但URL设置正确

试试这些应用程序设置,也许会解决问题。在大多数情况下确实如此。