Skip to content

Troubleshooting ​

Start with the check command. It runs the same setup as your app and says what is wrong in plain words:

bash
python -m microauth_fastapi check
python -m microauth_fastapi check --key map_...   # how one key would be treated

The 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 saysWhat to do
MICROAUTH_SECRET_KEY is missing or is not an SDK secret keySet 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 secretThe 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 errorThe machine cannot reach https://api.microauth.com. Allow outbound HTTPS, or check proxy settings
Everything passes, but the dashboard still waitsThe 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-Key unless you passed header_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.

StatusBody detailWhyFix
401Invalid or missing API keyNo key, a revoked key, or a key from another APICreate a key on the portal
402Insufficient credit balanceThe prepaid balance cannot cover one billable requestAdd credit on the portal, or grant credit from the customer's page
403This account is suspendedYou suspended the customer, or a subscription payment grace period ran outUnsuspend, or update the payment method
429Rate limit exceededAbove the customer's requests per second. Retry-After says when to retryRaise the limit on the plan or with a custom limit
429Monthly request quota exceededThe customer's monthly quota is used upRaise or remove the quota
429Platform monthly request allowance exhaustedYour MicroAuth plan's monthly allowance is used upUpgrade your plan
503Authorization is temporarily unavailableThe SDK secret key was rotated or the API is suspended, or the SDK could not get trustworthy data during a long outageDeploy 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.

MicroAuth is a product of Zyref, LLC.