Troubleshooting
Start with the check command. It runs the same setup as your app and says what is wrong in plain words:
python -m microauth_fastapi check
python -m microauth_fastapi check --key map_... # how one key would be treatedThe sections below cover what to do when it is not enough.
The SDK is not connecting
The dashboard says Waiting for your API to connect until the SDK fetches its first snapshot. Run the check from the directory your app runs in, then match the result:
| What the check says | What to do |
|---|---|
MICROAUTH_SECRET_KEY is missing or is not an SDK secret key | Set the key in the environment or a .env file. It starts with mas_ and is shown once when you launch the API. A map_ key belongs to a customer and will not work here |
the API rejected this secret | The key was rotated or belongs to another API. Copy the current one, or rotate it under Settings, SDK connection |
snapshot request failed with a connection error | The machine cannot reach https://api.microauth.com. Allow outbound HTTPS, or check proxy settings |
| Everything passes, but the dashboard still waits | The check ran against another MicroAuth server. Unset MICROAUTH_BASE_URL unless you were told to set it |
The status flips within a few seconds of a successful check. The dashboard also shows Online while the SDK has synced in the last three minutes and Idle after that, which is normal for an app with no traffic.
Connected, but the first request never shows up
The dashboard says SDK connected. Waiting for the first request. A request counts once it is authenticated with a customer key and its usage report arrives, which takes about five seconds.
- Make sure the route has
customer: Customer = Security(auth). Routes without it are not metered. - Send the key in the header the SDK reads. That is
X-API-Keyunless you passedheader_name. If you changed API key header on the Quickstart page tab, pass the same name:MicroAuth(app, header_name="X-Weather-Key"). - Use a key from this API's portal. Keys from another API return
401. - Keep the app running for a few seconds after the request so the usage report can be sent. On serverless platforms, see serverless tuning.
What each error means
These are the responses your customers get from your API when a check fails.
| Status | Body detail | Why | Fix |
|---|---|---|---|
401 | Invalid or missing API key | No key, a revoked key, or a key from another API | Create a key on the portal |
402 | Insufficient credit balance | The prepaid balance cannot cover one billable request | Add credit on the portal, or grant credit from the customer's page |
403 | This account is suspended | You suspended the customer, or a subscription payment grace period ran out | Unsuspend, or update the payment method |
429 | Rate limit exceeded | Above the customer's requests per second. Retry-After says when to retry | Raise the limit on the plan or with a custom limit |
429 | Monthly request quota exceeded | The customer's monthly quota is used up | Raise or remove the quota |
429 | Platform monthly request allowance exhausted | Your MicroAuth plan's monthly allowance is used up | Upgrade your plan |
503 | Authorization is temporarily unavailable | The SDK secret key was rotated or the API is suspended, or the SDK could not get trustworthy data during a long outage | Deploy the current SDK secret key, then check connectivity to MicroAuth and Redis |
A customer still gets 402 after adding credit
The SDK picks up balances on its next snapshot, every 30 seconds by default. Credit added through Stripe also waits for Stripe's webhook. If it never arrives, check the webhook setup and the event list.
Limits are higher than configured
Without Redis each worker process counts on its own, so four workers allow about four times the RPS. Add Redis to share counters across workers and machines.
Redis runs out of connections
The SDK keeps at most 64 Redis connections per process by default. With many workers on a small Redis plan, lower it: MicroAuth(app, redis_max_connections=10). See Redis connections under load.
The custom domain is not working
See custom domain troubleshooting. The most common cause is a proxied (orange cloud) record in Cloudflare.
Sign-in codes are not arriving
Codes come from no-reply@microauth.com. Check spam and any filter for automated mail, then request a new code. If your company blocks external senders, ask IT to allow that address.
Still stuck?
Email support@microauth.com with the output of the check command. It never prints full keys, so it is safe to paste.