File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
rest_framework_social_oauth2 Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
import json
3
3
4
- from braces .views import CsrfExemptMixin
5
4
from django .urls import reverse
5
+ from django .utils .decorators import method_decorator
6
+ from django .views .decorators .csrf import csrf_exempt
6
7
from oauthlib .oauth2 .rfc6749 .endpoints .token import TokenEndpoint
7
8
from social_core .exceptions import MissingBackend
8
9
from social_django .utils import load_strategy , load_backend
25
26
from .oauth2_endpoints import SocialTokenServer
26
27
27
28
29
+ class CsrfExemptMixin (object ):
30
+ """
31
+ Exempts the view from CSRF requirements.
32
+ NOTE:
33
+ This should be the left-most mixin of a view.
34
+ """
35
+
36
+ @method_decorator (csrf_exempt )
37
+ def dispatch (self , * args , ** kwargs ):
38
+ return super (CsrfExemptMixin , self ).dispatch (* args , ** kwargs )
39
+
40
+
28
41
class TokenView (CsrfExemptMixin , OAuthLibMixin , APIView ):
29
42
"""
30
43
Implements an endpoint to provide access tokens
Original file line number Diff line number Diff line change 24
24
'djangorestframework>=3.0.1' ,
25
25
'django-oauth-toolkit>=0.9.0' ,
26
26
'social-auth-app-django>=0.1.0' ,
27
- 'django-braces>=1.11.0' ,
28
27
],
29
28
include_package_data = True ,
30
29
zip_safe = False ,
You can’t perform that action at this time.
0 commit comments