diff --git a/demo/demo/settings.py b/demo/demo/settings.py index 1bc1149..89341b1 100644 --- a/demo/demo/settings.py +++ b/demo/demo/settings.py @@ -44,7 +44,6 @@ INSTALLED_APPS = ( 'django.contrib.staticfiles', 'django.contrib.sites', - 'corsheaders', 'rest_framework', 'rest_framework.authtoken', @@ -57,7 +56,7 @@ INSTALLED_APPS = ( MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', - 'corsheaders.middleware.CorsMiddleware', + 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', diff --git a/rest_auth/registration/serializers.py b/rest_auth/registration/serializers.py index 5cfe049..6682ba8 100644 --- a/rest_auth/registration/serializers.py +++ b/rest_auth/registration/serializers.py @@ -7,7 +7,9 @@ class SocialLoginSerializer(serializers.Serializer): access_token = serializers.CharField(required=True) - def validate_access_token(self, value): + + def validate(self, attrs): + access_token = attrs['access_token'] view = self.context.get('view') request = self.context.get('request') @@ -22,12 +24,12 @@ class SocialLoginSerializer(serializers.Serializer): self.adapter = self.adapter_class() app = self.adapter.get_provider().get_app(request) - token = self.adapter.parse_token({'access_token': value}) + token = self.adapter.parse_token({'access_token': access_token}) token.app = app try: login = self.adapter.complete_login(request, app, token, - response=value) + response=access_token) token.account = login.account login.token = token complete_social_login(request, login) @@ -37,6 +39,6 @@ class SocialLoginSerializer(serializers.Serializer): if not login.is_existing: login.lookup() login.save(request, connect=True) - self.object = {'user': login.account.user} + attrs['user'] = login.account.user - return value + return attrs diff --git a/test_settings.py b/test_settings.py index 0fc7eaa..2fcc1e3 100644 --- a/test_settings.py +++ b/test_settings.py @@ -75,5 +75,5 @@ ACCOUNT_ACTIVATION_DAYS = 1 SITE_ID = 1 MIGRATION_MODULES = { - 'rest_framework.authtoken': 'rest_framework.authtoken.migrations', + 'authtoken': 'authtoken.migrations', }