0

I am using django-rest-auth for facebook integration with android as front-end. I followed all the steps mentioned in integrating django-rest-auth.

I have only one SITE and set SITE_ID to 1

I have also set Client ID and Secret ID of my app and made sure i have choosen my site.

Here is a screenshot

enter image description here

Below is my code

 INSTALLED_APPS = [
    'rest_auth',
    'django.contrib.sites',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.facebook',
]

My custom Login Serializer

REST_AUTH_SERIALIZERS = {
    'LOGIN_SERIALIZER': 'cut_veggie_user.serializers.NormalUserSerializer',
}

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend',
)

SITE_ID = 1

In the urls I have also included the FacebookLogin

urlpatterns = [
              url(r'^rest-auth/facebook/$', FacebookLogin.as_view(),       name='fb_login'),
          ] 

Can anyone tell my what am i missing?

Arnold Laishram
  • 1,801
  • 2
  • 18
  • 25

2 Answers2

4

Figured out the problem finally.

I followed the below steps

python manage.py shell

then i got the site id for my website by this command

from django.contrib.sites.models import Site
new_site = Site.objects.create(domain='foo.com', name='foo.com')
print new_site.id

and added the id to SITE_ID in settings.py

To my surprise i got the site id as 3, which i am not sure why.

Thanks to this post

Community
  • 1
  • 1
Arnold Laishram
  • 1,801
  • 2
  • 18
  • 25
0

This Error is may be due the email verification. Add this code in your settings.py file.

ACCOUNT_AUTHENTICATION_METHOD = 'username'

ACCOUNT_EMAIL_VERIFICATION = 'none'

ACCOUNT_EMAIL_REQUIRED = False

And now authentication will work.