Django REST custom authentication
<p>Here's my issue guys. I have a store user that can log to his site and view all kinds of data related to his store. In his store he has, let's say 10 android billing devices that send bills to him. Now I need to create a custom authentication in Django REST framework that will authenticate android devices with their <code>id_number</code> and <code>type</code> fields (not store user's username &amp; password) and assign a token to them (each individually) and allow them to POST, GET, PUT etc.. Is that possible?</p>

<pre><code>Store(models.Model):
    user = models.ForeignKey(User, default=1)

AndroidDevice(models.Model):
    id_number = models.CharField()
    type = models.CharField()
    store= models.ForeignKey(Store)
</code></pre>

<p>yes... it is possible</p>

<p><strong>Note:</strong> use a <a href="http://www.django-rest-framework.org/api-guide/authentication/#custom-authentication" rel="nofollow">custom authentication</a> and create your own Token Model that is related to you AndroidDevice model instead of the User Model or whatever you need to do (multiple tokens, tokens that expires, etc.). Read the DRF source code to get inspired :)</p>

<p>Hope this helps</p>

python django authentication django-rest-framework custom-authentication