Question

I successfully run the example from The missing django-allauth tutorial to login with facebook, but now I have this error when I try to install django-allauth from scratch:

 Given URL is not allowed by the Application configuration

In facebook, my site URL is set to http://127.0.0.1:8000/, this works for the example but not my app. Where can the error come from?


I also don't understand the "sites" field in Django administration: Home › Socialaccount › Social apps › AppName. It is set to example.com by default, I don't know what to set here, although it works fine with example.com for the example...


Just for info, here is the example's main urls.py

from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns(
    '',
    # prevent the extra are-you-sure-you-want-to-logout step on logout
    (r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}),

    url(r'^', include('larb.urls')),
    url(r'^accounts/', include('allauth.urls')),
    url(r'^admin/', include(admin.site.urls)),
)

and urls.py for larb:

from django.conf.urls import patterns, url

from larb import views

urlpatterns = patterns('',
     url(r'^$', views.index, name='index')
)

and my unique main urls.py

from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.base import TemplateView
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from Romanesco import settings

admin.autodiscover()

urlpatterns = patterns('',

    url(r'^$', 'draw.views.index'),
    url(r'^accounts/', include('allauth.urls')),
    url(r'^admin/', include(admin.site.urls)),

) 

I have noticed a difference, in the example the facebook button links to href="/accounts/facebook/login/" ; whereas in the default login page (when it fails) it's href="javascript:allauth.facebook.login('', 'authenticate', 'login')".

If I go to http://127.0.0.1:8000/accounts/facebook/login/ manually it works!

Was it helpful?

Solution

In your browser, change http://127.0.0.1:8000/ to localhost:8000/

That should fix the problem.

Still under platform website, change site URL to http://localhost:8000/

OTHER TIPS

In parameter of your Facebook application (https://developers.facebook.com/x/apps/.../settings/advanced/) be sure to add a platform Website and add url: http://127.0.0.1:8000/ And after in advanced (still on parameter) put "Embedded browser OAuth Login" and "Client OAuth Login" on !

EDIT:

Ok so you need to add http://127.0.0.1:8000 in your admin site and after you go on each social app and add localhost on site field and not to example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top