evonove/django-oauth-toolkit — pull request #49 by eofs (2013-08-28 14:33:34+00:00)
Title: Rest Framework support view

By default `/o/token/` route accept data only in `application/x-www-form-urlencoded` format which adds restrictions to client implementations.

It would be great if Django OAuth Toolkit would support Rest Framework views out-of-the-box. This is my initial implementation for such support by adding new TokenAPIView.

You can use it by overriding `/o/token/` route or by defining a new route:

from oauth2_provider.ext.rest_framework.views import TokenAPIView
url(r'^o/token/', TokenAPIView.as_view())

Now you can POST data in any format you would like, as long as support for that Content-Type is defined in your Rest Framework settings.

**Note:** I couldn't add `TokenAPIView` into `oauth2_provider.ext.rest_framework.__init__` as it will create circular dependency.