I'm using node-oidc-provider as my OpenID Connect provider, with multiple Next.js (14 and 15) applications acting as clients. All clients use NextAuth.js for authentication and always request prompt=login
when initiating authentication. The clients are configured using the /.well-known/openid-configuration
served by node-oidc-provider. node-oidc-provider is served using expressjs.
However, when switching users, I get the following error:
POST <my oidc prefix>/session/end/confirm
error: invalid_request
error_description: interaction session not found
These are the steps I perform when switching users:
- Log in from a Next.js 15 client using NextAuth.js (
prompt=login
). - Log out (only from NextAuth, not explicitly from the OIDC provider).
- Log in again with
prompt=login
. - If logging in with the same user, everything works fine.
- If logging in with a different user, I receive the error above.
Why does this error occur only when switching users, and how can I properly handle user switching while using prompt=login?