cholalabs / passport-localapikey

MIT License
165 stars 57 forks source link

Does this support generating a new api key? #10

Open i-ask-too-many-questions opened 9 years ago

i-ask-too-many-questions commented 9 years ago

The example shows two pre-generated api keys to use for authentication purposes. I need new users to sign up and have new api keys generated for them. Is this possible? And if so, how? Thank you.

sellcorpllc commented 9 years ago

Strategies are only used for authenticating, not generating api keys. An easy solution to this problem is to create a route that accepts user credentials and uses another passport strategy(maybe use the local strategy), and then return an api key for others to use via a post or get request. Finally, the next step is to use this strategy for authentication purposes and protecting other parts of an api.

robcalcroft commented 8 years ago

I suggest using https://github.com/substack/node-hat to generate API keys then store them in your database along with the user's details