Auth.js Passage Provider - User Not Being Signed Out of Passage During Logout #13079
-
Issue SummaryI am using the passage provider for Auth.js in my Next.js project. I have successfully enabled login via Passage OAuth. However, I am experiencing an issue where calling SetupAuth.js Configuration: // auth.ts
import NextAuth from "next-auth"
import Passage from "next-auth/providers/passage"
export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [Passage],
}) SignOut Component: 'use client'
import { signOut } from 'next-auth/react'
export function SignOut() {
const handleSignOut = async () => {
await signOut({
callbackUrl: '/',
redirect: true
});
};
return <button onClick={handleSignOut}>Sign Out</button>;
} Expected BehaviorWhen
Actual Behavior
InvestigationI've confirmed that:
Questions
Attempted Solutions
Environment
Additional ContextAccording to OIDC specs, the logout flow should involve calling the provider's Any insights or similar experiences would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Fixed it!After some troubleshooting, I figured it out. Auth.js only clears its own session and doesn't automatically call the provider's logout endpoint. The fix is pretty simple: call Here's what worked for me: const handleSignOut = async () => {
await signOut({ redirect: false });
window.location.href = `${process.env.NEXT_PUBLIC_AUTH_PASSAGE_ISSUER}logout?post_logout_redirect_uri=${encodeURIComponent(window.location.origin)}`;
}; This "federated logout" pattern applies to most OIDC providers (Auth0, Keycloak, etc.) - not just Passage. Hope this helps anyone else running into the same issue! |
Beta Was this translation helpful? Give feedback.
Fixed it!
After some troubleshooting, I figured it out. Auth.js only clears its own session and doesn't automatically call the provider's logout endpoint. The fix is pretty simple: call
signOut({ redirect: false })
to clear the local session, then manually redirect to Passage's logout endpoint. You'll also need to add your domain to the logout redirect URLs in your Passage Console settings.Here's what worked for me:
This "federated logout" pattern applies to most…