{"action":"created","issue":{"url":"https://api.github.com/repos/GetBlimp/django-rest-framework-jwt/issues/84","labels_url":"https://api.github.com/repos/GetBlimp/django-rest-framework-jwt/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/GetBlimp/django-rest-framework-jwt/issues/84/comments","events_url":"https://api.github.com/repos/GetBlimp/django-rest-framework-jwt/issues/84/events","html_url":"https://github.com/GetBlimp/django-rest-framework-jwt/issues/84","id":59915813,"number":84,"title":" customize djangorestframework-jwt for authentication with email or username interchangeably  and password                              ","user":{"login":"xmonfort","id":666342,"avatar_url":"https://avatars.githubusercontent.com/u/666342?v=3","gravatar_id":"","url":"https://api.github.com/users/xmonfort","html_url":"https://github.com/xmonfort","followers_url":"https://api.github.com/users/xmonfort/followers","following_url":"https://api.github.com/users/xmonfort/following{/other_user}","gists_url":"https://api.github.com/users/xmonfort/gists{/gist_id}","starred_url":"https://api.github.com/users/xmonfort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xmonfort/subscriptions","organizations_url":"https://api.github.com/users/xmonfort/orgs","repos_url":"https://api.github.com/users/xmonfort/repos","events_url":"https://api.github.com/users/xmonfort/events{/privacy}","received_events_url":"https://api.github.com/users/xmonfort/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GetBlimp/django-rest-framework-jwt/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-05T07:33:49Z","updated_at":"2015-03-06T18:31:33Z","closed_at":"2015-03-06T18:31:33Z","body":"I am writing a backend api using django rest-framework. I would like jwt authentication using email or username interchangeably   (one or other) and password instead of using username and password. \r\nIs there any way using your djangorestframework-jwt package?\r\n\r\nThanks in advance.\r\n\r\nXavier Monfort Faure"},"comment":{"url":"https://api.github.com/repos/GetBlimp/django-rest-framework-jwt/issues/comments/77610148","html_url":"https://github.com/GetBlimp/django-rest-framework-jwt/issues/84#issuecomment-77610148","issue_url":"https://api.github.com/repos/GetBlimp/django-rest-framework-jwt/issues/84","id":77610148,"user":{"login":"jpadilla","id":83319,"avatar_url":"https://avatars.githubusercontent.com/u/83319?v=3","gravatar_id":"","url":"https://api.github.com/users/jpadilla","html_url":"https://github.com/jpadilla","followers_url":"https://api.github.com/users/jpadilla/followers","following_url":"https://api.github.com/users/jpadilla/following{/other_user}","gists_url":"https://api.github.com/users/jpadilla/gists{/gist_id}","starred_url":"https://api.github.com/users/jpadilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpadilla/subscriptions","organizations_url":"https://api.github.com/users/jpadilla/orgs","repos_url":"https://api.github.com/users/jpadilla/repos","events_url":"https://api.github.com/users/jpadilla/events{/privacy}","received_events_url":"https://api.github.com/users/jpadilla/received_events","type":"User","site_admin":false},"created_at":"2015-03-06T18:31:33Z","updated_at":"2015-03-06T18:31:33Z","body":"@xmonfort There are a couple of ways, you could write your own serializer based off `JSONWebTokenSerializer`. It currently uses your User's model `USERNAME_FIELD`, which by default is `username`. It uses your authentication backend to authenticate your user based on that field and `password`. You could use the default serializer implementation and probably just have a a custom authentication backend that checks if the username looks like an email and try to find a user that way."}}