Authentication
Learn how to authenticate with our API.
API Key Authentication
The simplest way to authenticate is using your API key:
const api = require("our-api");
api.init({
apiKey: "YOUR_API_KEY",
});
OAuth Authentication
For more advanced scenarios, you can use OAuth:
const api = require("our-api");
api.authenticate({
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
redirectUri: "https://your-app.com/callback",
});
Best Practices
- Never expose your API keys in client-side code
- Rotate your API keys periodically
- Use environment variables to store sensitive credentials