jpulgarin/django-tokenapi

Non-functional @token_required ?

Closed this issue · 5 comments

I'm trying to user the @token_required on an otherwise un-noteworthy view, but wasn't able to get it to work (would only return 403s). I ended up making my own decorator that users token_generator.check_token to verify the request.

Is anyone else using this successfully? Am I missing some step or was there some change recently?

My relevant code is https://gist.github.com/stickwithjosh/5f622336adefe24de17f

Hey @stickwithjosh, I wasn't able to reproduce this. Can you paste your entire decorator?

@jpulgarin Here's a diff of the two files, I'll try and put together a simplified test case to confirm this as the project I'm using tokenapi in has gotten large enough to not be useful for that.

http://www.diffchecker.com/tcwdxoab

Hmm, do you have tokenapi.backends.TokenBackend in your AUTHENTICATION_BACKENDS?

That was exactly the problem. Thanks for looking into this for me!

👍

Awesome :)