django-rest-auth

Django Rest Framework + AngularJS not logging user in or throwing errors

早过忘川 提交于 2019-12-13 06:00:05
问题 This is my URLS.py: from django.conf.urls import url from django.conf.urls import include from CMSApp import views urlpatterns = [ url(r'^$', views.HomePageView.as_view()), url(r'^users$', views.user_list.as_view()), url(r'^users/(?P<pk>[0-9]+)$', views.user_detail.as_view()), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), ] So to login, I use the URL /api-auth/login. When I go to /api-auth/login, I see the DRF login screen. If I type in an incorrect username

Is there any way to change view of Django-rest-auth of login?

安稳与你 提交于 2019-12-12 12:13:32
问题 I've created rest APIs using Django-rest-auth, in login, it's returning key and some user info, But I need to add some status like success and message and some other things. Is there any way to override view of django-rest-auth for login? class TokenSerializer(serializers.ModelSerializer): user = UserSerializer(many=False, read_only=True) # this is add by myself. device = DeviceSerializer(many=True, read_only=True) class Meta: model = TokenModel fields = ('key', 'user', 'device',) 回答1: Create

CSRF token is incorrect after login in SPA, but correct after page refresh

断了今生、忘了曾经 提交于 2019-12-12 10:14:34
问题 We make react SPA with django-rest-framework on backend and use django-rest-auth for user authentication. When user has logged in, we show him form for change profile data. When user submit this form, we take csrf token from cookie in login response, and put them in request X-CSRFToken header. Server responses that token is missing or incorrect. If user refreshed the page, and repeated the same actions, csrf token is correct and profile data is updated. How to solve this problem and why it

Email confirm error rest-auth

两盒软妹~` 提交于 2019-12-12 03:13:25
问题 I use a standard form for the confirmation email: from allauth.account.views import confirm_email as allauthemailconfirmation urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^rest-auth/', include('rest_auth.urls')), url(r'^accounts/', include('allauth.urls')), url(r'^rest-auth/registration/account-confirm-email/(?P<key>\w+)/$', allauthemailconfirmation, name="account_confirm_email"), url(r'^rest-auth/registration/', include('rest_auth.registration.urls')), ] Settings: LOGIN_REDIRECT

Django auth: self.request.user is always Anonymous in viewset

和自甴很熟 提交于 2019-12-11 15:32:58
问题 I'm trying to make the server only return documents which were created by the logged-in user. I'm following this post and this one but the logged in user is returned as "Anonymous". I am using Django Rest Framework with Django Rest Auth, and a custom user, but no other customisations. Django 2.0.10 Here is my viewset in api.py: from rest_framework import viewsets, permissions from .models import List, Item from .serializers import ListSerializer, ItemSerializer class ListViewSet(viewsets

JSON Web Token for Django REST won't authenticate to user database

白昼怎懂夜的黑 提交于 2019-12-11 00:15:25
问题 I have a working Django REST API backend. I was previously using session authentication, but would like to move to token based for scaling across multiple servers. I have been researching this for a couple days now and I have not found an answer to my problem. I added the djangorestframework-jwt package to my application but when I try to authenticate is always returns: {"non_field_errors":["Unable to login with provided credentials."]} I see in the jwt package where this error is, and can

django-allauth returns error Reverse for 'account_confirm_email' with arguments '()' and keyword arguments '{}' not found

被刻印的时光 ゝ 提交于 2019-12-10 16:13:11
问题 I am using django-allauth along with django rest-auth. here is the stacktrace: [2016-02-15 23:45:35,093] ERROR [base:handle_uncaught_exception:256 8977] Internal Server Error: /api/rest-auth/registration/ Traceback (most recent call last): File "/home/.../webapps/project_test/lib/python2.7/Django-1.8.7-py2.7.egg/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/.../webapps/project_test/lib/python2.7

My 'access_token' from facebook is “incorrect value”

北城余情 提交于 2019-12-07 12:57:59
问题 I'm using django-rest-auth which is "API extension for Django all-auth". I'm building a mobile app which can signup/login using Facebook token (url: http://localhost:8000/rest-auth/facebook/). get Facebook token using 'expo' export const doFacebookLogin = () => async dispatch => { let { type, token } = await Facebook.logInWithReadPermissionsAsync('194632xxxxxx', { permissions: ['public_profile'] }); if (type === 'cancel') { return dispatch({ type: FACEBOOK_LOGIN_CANCEL }) } doSocialAuthLogin

Django rest auth with Allauth

て烟熏妆下的殇ゞ 提交于 2019-12-07 04:58:57
问题 I have implemented django rest auth with Allauth and its working fine if I login through google access_token but there is a case when some client device need to login by google id_token . I am getting error if I use id_token instead of access_token { "non_field_errors": [ "Incorrect value" ] } please help me out 回答1: Update your files like ../allauth/socialaccount/providers/google/provider.py : class GoogleProvider(OAuth2Provider): .... def extract_uid(self, data): try: return str(data['id'])

Django Rest Framework - Why is a 200 status code returned when trying to login a user using incorrect credentials?

99封情书 提交于 2019-12-06 00:39:14
This is my URLs.py: url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), I have a form on my homepage where users can type a username and password. When the submit button is clicked, AngularJS sends a POST request to "api-auth/login/" with the user object (username and password): $http.post("/api-auth/login/", self.loginuser) .error(function(data, status, headers, config) { console.log(data); }); When a user submits an incorrect username and password (username and password which either do not exist or do not match), Django Rest Framework returns a 200 OK rather than