[Answered ]-Django authentication from iOS client

2👍

In tastypie there’s a management command to generate API keys to the users that doesn’t have one:

python manage.py backfill_api_keys

Also you’ll need a method to autogenerate an API key for each new user, from Tastypie docs:

from django.contrib.auth.models import User
from django.db import models
from tastypie.models import create_api_key

models.signals.post_save.connect(create_api_key, sender=User)

Once all the clients have the API key you can use BasicAuthentication to get the access token to use in your app. Check this gist, and then you can make a request to http://example.com/api/token/auth/ to get your token.

Check out this post for an iOS example using OAuth2

Leave a comment