Best Practices
Follow these guidelines to keep your maps.guru integration secure in production.
API Key Security
Never Expose Keys in Client-Side Code
// BAD — key visible in browser source
const map = new maplibregl.Map({
style: `https://maps.guru/api/v1/styles/standard/light/style.json?key=mapx_secret_key`
});
Instead, proxy through your backend:
// GOOD — key stays on your server
const map = new maplibregl.Map({
style: '/api/map-style' // Your backend fetches with the API key
});
Use Environment Variables
# .env (never committed)
MAPS_GURU_API_KEY=mapx_your_key
// server.js
const apiKey = process.env.MAPS_GURU_API_KEY;
Separate Keys Per Environment
| Environment | Key Name | Scopes |
|---|---|---|
| Development | Dev Key | All |
| Staging | Staging Key | All |
| Production | Prod Backend | geocoding, routing |
| Production | Prod Maps | maps |
HTTPS Only
All maps.guru endpoints enforce HTTPS. Never use HTTP — it exposes your API key in transit.
Restrict Key Scopes
Follow the principle of least privilege:
- If an application only needs geocoding, create a key with only the
geocodingscope - If a frontend only displays maps, use a key with only the
mapsscope - Never use the default all-scopes key in production
Monitor Usage
Set up monitoring to detect anomalies:
- Check daily — Review the usage dashboard for unexpected spikes
- Set alerts — Configure budget warnings in the admin dashboard
- Audit keys — Regularly review which keys exist and revoke unused ones
Rotate Keys Regularly
Establish a key rotation schedule:
- Create a new key
- Deploy the new key to your application
- Verify everything works
- Revoke the old key
- Repeat quarterly (or after any team member departure)
Incident Response
If you suspect a key has been compromised:
- Revoke immediately — Go to Dashboard → API Keys → Revoke
- Create a new key — Generate a replacement
- Update applications — Deploy the new key
- Review usage — Check for any unauthorized requests
- Audit access — Review who had access to the compromised key
OAuth Consent Management
OAuth-authorized clients are managed separately from mapx_ keys. The platform splits them across two dashboard pages so each type is manageable at the right granularity:
- maps.guru/dashboard/settings/connected-apps — remote MCP connectors (ChatGPT, Claude) and other third-party OAuth clients. One row per client, regardless of how many machines you've approved it on.
- maps.guru/dashboard/settings/devices — individual
@invarya/maps-mcp auth logininstalls (each machine or CLI sandbox is its own row). CLI entries are deliberately filtered out of Connected Apps to avoid clutter — revoke a specific machine here, or revoke all your CLI installs in one pass.
Revoking an OAuth Client
When you revoke an OAuth consent, the platform does three things atomically:
- Marks every refresh token revoked for that
(user, client)pair (oauth_refresh_token.revoked = NOW()). The client cannot mint a fresh access token. - Hard-deletes any stored access tokens for that pair. (Most access tokens are stateless JWTs — those still expire on their own within 15 minutes — but any opaque tokens are nuked instantly.)
- Deletes the consent row. The next OAuth flow lands on the consent screen instead of being silently approved.
In practical terms: revoking an OAuth client locks them out at most 15 minutes later (the JWT TTL), with a hard guarantee that they cannot refresh. Often it's effective immediately.
Platform-wide Audit (Superadmin Only)
Superadmins (user.role === 'admin') get a global view at maps.guru/dashboard/settings/admin/oauth-consents — every consent across every user. Useful for:
- Spotting an OAuth client that suddenly has thousands of grants (potential abuse signal)
- Force-revoking a misbehaving client across all users in one click
- Verifying which orgs have authorized which AI integrations
Search by user email/name or client name; filter by clientId.
When to Revoke vs Rotate
| Situation | Action |
|---|---|
| Stop a single remote MCP connector (ChatGPT, Claude) | Revoke its consent in connected-apps |
Revoke auth login for a specific CLI machine | Revoke that device in devices |
| Revoke every one of your CLI installs at once | Select all on the devices page and revoke |
| Suspect a single user's session was compromised | Revoke their OAuth consents — refresh tokens die, JWT max 1 hour |
Suspect a mapx_ key leaked | Rotate the key (different flow — see "Key Rotation Strategy" above) |
| Lock an entire OAuth client out platform-wide | Superadmin → OAuth consents page → revoke all |
mapx_ keys (long-lived bearers used for tiles, geocoding, embeds) and OAuth consents (short-lived JWTs used by MCP) live on separate tracks. Revoking one doesn't affect the other.