Created
May 30, 2017 06:41
-
-
Save alces/f22c24001b2666fb687d19ee6810173d to your computer and use it in GitHub Desktop.
Eve server with token authentication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# to connect it using curl: | |
# curl -H 'Authorization: Token 9d003d9a-2288-46b8-bfeb-7cec1eb53074' http://my.host.name/api/my_collection/ | |
import eve | |
class MyTokenAuth(eve.auth.TokenAuth): | |
def check_auth(self, token, allowed_roles, resource, method): | |
return token == '9d003d9a-2288-46b8-bfeb-7cec1eb53074' | |
app = eve.Eve(auth = MyTokenAuth) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment