python - Creating api tokens for third parties -
i'm working on application third parties interested in integrating us. create token each user , wondering efficient , common way in django? tried find one, , found looks promising:
https://github.com/jpulgarin/django-tokenapi
obviously out of box wont work, can implement similarly. above project uses sha hashing algorithm. safe use or md5 api tokens? appreciated!
when you're choosing api keys, 2 factors you're looking are
infeasable guess. mean key must appear random , long brute force
is unique. means no 2 users can accidentally same api key. can enforce database uniqueness constraints.
remember, if you're using 1 key, must enable ssl on of api endpoints. having keys stolen in transit bad, m'kay?
now, implementation, if you're using own custom views serve api, https://github.com/jpulgarin/django-tokenapi should work you.
if, you're using tasypie or similar, may want use built-in authorization code, including api-key management.
http://django-rest-framework.org/api-guide/authentication.html#tokenauthentication
Comments
Post a Comment