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

  1. infeasable guess. mean key must appear random , long brute force

  2. 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-tastypie.readthedocs.org/en/latest/authentication_authorization.html#apikeyauthentication

http://django-rest-framework.org/api-guide/authentication.html#tokenauthentication


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -