1. Jesper Nøhr
  2. django-piston
Issue #159 new

Duplicate Tokens

Ahmad Al-Ibrahim
created an issue

It is possible to have duplicate tokens if oauth_timestamp is the same and requests came in the same time.

I came across this problem when 3 requests to request a token came in the same time with the same timestamp, first 2 were saved, and the third got: MultipleObjectsReturned: get() returned more than one Token -- it returned 2!

In http://bitbucket.org/jespern/django-piston/src/tip/piston/managers.py#cl-58

Do we really need get_or_create call in TokenManager create_token method? I'm thinking replacing 'get_or_create' manager method with 'create' could solve the problem.

Comments (1)

  1. Log in to comment