-
Notifications
You must be signed in to change notification settings - Fork 10
Managing API Keys
Jeff Douglas edited this page Oct 8, 2013
·
3 revisions
To access restricted routes, an API Key must be passed in the request header for authorization:
Token token="THIS-IS-MY-TOKEN"
API Keys are stored as hashes in redis. If the passed API Key matches the hash key in redis, then the access is authorized to the route. If not a 401 error is returned.
To add an API Key for a particular user to redis:
hset "api:keys" KEY USER
To remove an API Key from redis:
hdel "api:keys" KEY
To fetch the list of API Keys from redis:
hkeys "api:keys"
To determine if an API Key exists in redis:
hexists "api:keys" KEY
To determine who a key belongs to:
hget "api:keys" KEY