---
title: "Troubleshooting"
description: "The most common errors when integrating Block-Auth, what causes them and how to fix them."
url: "/troubleshooting/"
language: "en"
---

# Troubleshooting

The most common errors when integrating Block-Auth. Each one shows the message you see, why it happens and how to fix it.

## App not active

**Message:** `App not active, contact your admin` (`403`).

**Cause:** your app is not active yet. An app becomes active only after its domain is validated with a DNS record.

**Fix:** in the Dashboard, open the app, copy the verification value and add it as a `TXT` record on your domain. Then press validate. DNS changes can take a few minutes to propagate. See [Validate your domain](/integration-quickstart.md#apps-validate-domain).

## Authentication blocked

**Message:** `Authentication blocked: tenant billing grace period ended.` (`403`).

**Cause:** your company account has a pending payment and the grace period is over. Logins to all its apps are blocked.

**Fix:** settle the billing from the Dashboard. Logins work again as soon as the account is up to date.

## Invalid redirect\_uri

**Message:** `Invalid redirect_uri` (`400`), from `/api/auth/authorize` or `/api/auth/token`.

**Cause:** the `redirectUri` you send doesn't meet the rules.

**Fix:** make sure that it:

- Uses `https` on your app's validated domain, with exactly its host, port included.
- Or, to test on your computer, uses `http://localhost`, `127.0.0.1` or `[::1]` on any port with the keys of your app's [development environment](/integration-quickstart.md#apps-local-development). The production keys never accept `localhost`.
- Has no user, password or `#fragment`, and is shorter than 2048 characters.
- Is the same in `/api/auth/authorize` and in `/api/auth/token`.

## Local login is limited to the app team

**Message:** `Local login is limited to the app team`, on the login screen.

**Cause:** the login uses your app's [development environment](/integration-quickstart.md#apps-local-development), and the user who signed in is not a member of the workspace that owns the app.

**Fix:** add that user in **Settings → Members** of the Dashboard, or sign in with a member's identity. Your users never see this on your validated domain.

## Invalid code

**Message:** `Invalid code` (`400`), from `/api/auth/token`.

**Cause:** the code expired, was already redeemed, or was issued for another `redirectUri`.

**Fix:** redeem the code as soon as your callback receives it: it lasts **60 seconds** and works **only once**. Don't redeem it twice, for example on a page reload or a double request. Send the same `redirectUri` you used to get it.

## The login popup does not open

**Message:** the login opens in the same tab instead of a popup, or `Login window closed` in the browser console.

**Cause:** the browser blocked the popup, or your page lost contact with it.

**Fix:**

- If the browser blocks the popup, the widget opens the login in the same tab: that's expected. Block-Auth sends the user back to the root of your app (`/`) and the widget finishes the login on the page where it started. For that, your root must load your frontend with the widget config; if the user lands there signed out, check it.
- Open the login straight from the user's click. If your code awaits something before opening it, the browser blocks the popup.
- Serve the page from your app's validated domain.
- If your site sends `Cross-Origin-Opener-Policy: same-origin`, change it to `same-origin-allow-popups`. Otherwise your page can't receive the result from the popup.

## Backend routes do not answer

**Message:** `[Block-Auth] …` in the browser console, after the login or when the page loads.

**Cause:** the widget calls `/code`, `/me` and `/logout` under `/auth/blockauth` (or your `authEndpoint`), and one of them is missing, unreachable or answered by your frontend instead of your backend.

**Fix:** follow the message. It names the route and what to change:

- `answered 404`: add that route to your backend ([Backend routes](/sdk-integration-spa-backend.md#backend-routes)).
- `did not reach your backend`: serve the routes from the same origin as your page, or allow your page's origin in your backend's CORS with credentials. The routes must answer without redirects.
- `without JSON`: your frontend server answered instead of your backend. Proxy `/auth/blockauth` to your backend in your dev server ([examples for Vite, Next.js and Angular](/sdk-integration-spa-connect.md#connect-frontend)) and in production.
- `could not redeem the code`: check your backend logs and the `apiKey`, `apiSecret` hash and `redirectUri` it sends to `/api/auth/token`.

## Content Security Policy

**Message:** the Block-Auth button shows up without styles and with a broken logo, or errors like `Refused to connect to …` or `Applying inline style violates … Content Security Policy` appear in the console.

**Cause:** your site sends a CSP that doesn't allow the widget's styles, logo or connections. It usually shows up only in production, because the dev server doesn't send that header.

**Fix:** add the widget's sources to your CSP:

**Content-Security-Policy**

```text
connect-src 'self' https://wss.block-auth.io wss://wss.block-auth.io;
img-src 'self' data:;
style-src 'self' 'unsafe-inline';
```

What each one is for is in [Go live](/sdk-integration-spa-go-live.md#production-csp).

## No webhooks arrive

**Cause:** the URL is ignored, or your endpoint takes too long.

**Fix:** check that the URL in the Dashboard uses `https`, is on your app's domain and is not `/signout/callback`. Answer in under 5 seconds and don't redirect. Each event is sent only once. See [Webhooks](/webhooks.md#delivery).

## Other API errors

| Message                                      | Cause                                               | Fix                                                                               |
| -------------------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------- |
| `App not found`                              | Wrong `apiKey`, or `apiSecret` not hashed.          | Send the [SHA-256 of the `apiSecret`](/api-intro.md#hash-secret), not the secret. |
| `Unauthorized, valid token required` (`401`) | Missing or expired access token on a data endpoint. | Get a new one with [`/api/refresh`](/api-intro.md#refresh) or `/api/signin`.      |
| `Too many requests` (`429`)                  | Too many failed credential attempts from your IP.   | Fix the credentials and wait the seconds in `Retry-After`.                        |
| `User not signed in APP yet` (`403`)         | The user's session for your app ended.              | Ask the user to log in again.                                                     |

## Errors when adding Block-Auth to the code

These come from the developer's own app, not from the Block-Auth API. Read the exact message in the backend console or the browser console and match it here.

| Message                                                                                                                                              | Cause                                                                                                                                                                        | Fix                                                                                                                                                                                                                                                                                           |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Block-Auth routes need express-session (or a compatible req.session) before blockauthRouter`                                                        | Node.js: there is no session, or it only covers part of the app (for example `app.use('/api', session(...))`).                                                               | Mount `app.use(session(...))` for the whole app, before `app.use(blockauthRouter(routes))`. Reuse the app's session if it already has one.                                                                                                                                                    |
| `Mount blockauthRouter before express.json(): the webhook signature needs the raw body`                                                              | Node.js: a JSON body parser runs before the Block-Auth routes.                                                                                                               | Order: session, then `blockauthRouter(routes)`, then `express.json()`. If the parser only covers `/api`, it can stay there.                                                                                                                                                                   |
| `Block-Auth routes need Starlette's SessionMiddleware`                                                                                               | FastAPI: no `SessionMiddleware`.                                                                                                                                             | `app.add_middleware(SessionMiddleware, secret_key=os.environ["SESSION_SECRET"], same_site="lax", https_only=APP_URL.startswith("https"))`, once.                                                                                                                                              |
| `Set appUrl or allowedOrigins: the origins your frontend runs on` (Python: `Set app_url or allowed_origins…`, .NET: `Set AppUrl or AllowedOrigins…`) | `APP_URL` is empty when `BlockAuthRoutes` is created. Often the `.env` isn't loaded, or the routes are created at import time and a test imports the file without variables. | Load the variables (`node --env-file=.env`, `python-dotenv`, server variables). If the app is built in a function that receives its config (`createApp(config)`), create `routes` inside it from that config, and give the tests test values.                                                 |
| `"./tempo/zones" is not exported … viem` (Vite, when starting the frontend)                                                                          | An older `@block-auth.io/react`, `vue` or `angular` let npm install a `viem` version that `@wagmi/core` can't use.                                                           | Update the Block-Auth frontend package to its latest version. If you can't yet, add `"overrides": { "viem": ">=2.53.1 <2.56.0" }` to the frontend `package.json` and reinstall; remove it after updating.                                                                                     |
| `ModuleNotFoundError: No module named 'dotenv'` (when starting uvicorn or Flask)                                                                     | Python: `uvicorn --env-file` and `flask run` use `python-dotenv` to read the `.env`, and it isn’t installed.                                                                 | Install it in your backend (`uv add python-dotenv`, `poetry add python-dotenv` or `pip install python-dotenv`), or with uv start with `uv run --env-file .env …`, which doesn’t need it.                                                                                                      |
| `GET /auth/blockauth/me` returns your app's HTML page or `404`                                                                                       | The request doesn't reach the backend: the dev proxy for `/auth/blockauth` is missing, or production doesn't route it to the backend.                                        | Add `/auth/blockauth` to the dev server proxy, next to the app's other proxied paths, pointing to the backend port. In production, serve everything from one origin.                                                                                                                          |
| `GET /auth/blockauth/me` returns `401` after signing in                                                                                              | The login didn't create the session: the code redemption failed, or the cookie wasn't stored.                                                                                | Pass a `logger` to `BlockAuthRoutes` (for example `logger: (message, error) => console.error(message, error?.message)`) and read the backend console. Check `APP_URL`, the keys, that the session cookie isn't `Secure` on plain `http` and that `trust proxy` is on behind an `https` proxy. |
| The app still shows its own login page after a successful Block-Auth login                                                                           | Expected when the app already has a login: its own session check doesn't know the Block-Auth user. `/auth/blockauth/me` returns the user.                                    | Optional: read the Block-Auth session in the app's own "who am I" route and link existing users ([Use the session in your routes](/sdk-integration-spa-session.md), [Link users](/sdk-integration-spa-extras.md#link-users)).                                                                 |
| The widget loads without an apiKey, or a `.env` change has no effect                                                                                 | The variable has the wrong prefix for the build tool, or the dev server didn't reload it. Frontend variables are baked in at build time.                                     | Use `VITE_`, `NEXT_PUBLIC_` or `REACT_APP_` as the tool needs, restart the dev server, and rebuild for production with the production key.                                                                                                                                                    |
| Angular build warns about CommonJS or fails on optional wallet dependencies                                                                          | The widget's wallet libraries need build options.                                                                                                                            | Add the `allowedCommonJsDependencies` and `externalDependencies` from [Your frontend](/sdk-integration-spa-frontend.md#install-widget) to `angular.json`.                                                                                                                                     |
| `App not unique`                                                                                                                                     | Two apps in the Dashboard have the same validated domain.                                                                                                                    | Remove the domain validation from the old app, or use a different domain.                                                                                                                                                                                                                     |

If you still can't solve it, contact [Block-Auth support](/support.md) with the exact error message.
