Skip to content

Troubleshooting

Greg Bowler edited this page Nov 1, 2026 · 2 revisions

A login crosses the application, browser and provider. Check each boundary in turn.

The session has not started

SessionNotStartedException means a core container was constructed without a request-scoped record, or Express lacks express-session. Use a runtime adapter or supply a container explicitly. Node.js has no equivalent automatic $_SESSION global.

The provider returns but the visitor remains logged out

Ensure the return route runs the wrapper or constructs Authenticator with its actual path and query. Check the same cookie arrives and the shared store still holds the login token. Cookies marked Secure are not sent over ordinary HTTP; use secureCookie: false only locally.

Responses without session data are removed without authenticating a visitor. A token-only session is a login in progress, not a logged-in user.

Headers have already been sent

Construction, login and logout can all redirect. Return bodies from Node.js and Express handlers instead of writing headers yourself. Do not catch and swallow RedirectSignal. Next.js integration belongs in Node.js Route Handlers, not Client Components or Edge middleware.

The response cannot be decrypted

Check deployment key, provider host and the token from the same exchange. A lost session, changed key or second concurrent login can make an old response unusable. The secret is 32 raw bytes, not base64-decoded data.

Cipher failures raise DecryptionFailureException; the authenticator does not throw ResponseCipherDecryptionException. Log through application error handling without logging secrets or encrypted URLs and offer a fresh login.

Login returns to an unexpected page

Call setReturnUri() before login. Otherwise the client requests its current URI. Root-relative and same-origin absolute URLs are supported by the provider; query-only and fragment-only login destinations use its configured return path. Invalid or external destinations fall back to that path. Ensure the destination runs authentication setup. See Provider configuration and return URIs.

A callback did not run again

Session restoration does not invoke the callback. The marker is stored before invocation, so throwing does not retry the callback on replay. Keep callbacks synchronous and arrange retries separately. See Responding to a new authentication.

Logout returns to an unexpected page

Explicit logout destinations override configured return URIs. With neither supplied, the provider uses its default with do=logout. Query-only destinations use the current path. Do not call logout repeatedly on the signed-out route.


For signatures, see API reference.

Clone this wiki locally