RealmTeam / django-rest-framework-social-oauth2

python-social-auth and oauth2 support for django-rest-framework
MIT License
1.06k stars 191 forks source link

How to add new fields in TokenView? #178

Closed fabiovasini closed 5 years ago

fabiovasini commented 6 years ago

Hello,

Is there a proper way to add new fields in the TokenView response?

My approach:

class MyTokenView(TokenView):

    def post(self, request, *args, **kwargs):
        response = super().response(request, *args, **kwargs)
        response['field_key'] = 'field_value'
        return response
PhilipGarnero commented 5 years ago

You've got the right approach !