Using API Keys With RavenDB
Api keys are used when trying to authorize with OAuth.
Here are the steps needed in order to set the api keys:
- Open the browser
- Navigate to:
http://localhost:{your server port}
- Go to the Databases section and select "System Database" on the top right
- Go to the settings (press the cog wheel next to the database name)
- In the Api Keys section Add a new key, select a name, generate a secret and add a database for your database
- Don't forget to click the "Save Changes" button"
A few tips:
- In order to set a key to all databases in the database name enter "*" (this will NOT grant access to the system database)
- To grant access to the system database set the database name to "<system>".
Once all settings are entered give the user the "full api key" (you can right-click on it to copy).
In order to use this api key the user needs to set the api key when settings a new DocumentStore like this:
var store = new DocumentStore
{
Url = "http://localhost:" + port,
DefaultDatabase = "ApiKeySample",
ApiKey = apiKey
}.Initialize();