I have created an own ApiView for a login that generates a token for the user. In a REST client I can use this token together with the TokenAuthentication but in the browsable API not. Can I add a login form or do I have to hardcode the token somewhere?
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
| | Filipe Ximenes Vinta Software Studio +55 (81) 8245-9204 |
The easiest way is to also allow SessionAuthentication as well as TokenAuthentication in your view.This can be done globally in your settings:REST_FRAMEWORK = {'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework.authentication.TokenAuthentication','rest_framework.authentication.SessionAuthentication',)}or in your view:class MyView(APIView):authentication_classes = (TokenAuthentication, SessionAuthentication)...
On Wed, Mar 11, 2015 at 1:30 PM, Sven Mäurer <maeure...@gmail.com> wrote:
I have created an own ApiView for a login that generates a token for the user. In a REST client I can use this token together with the TokenAuthentication but in the browsable API not. Can I add a login form or do I have to hardcode the token somewhere?
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.