Repository navigation
Logging out
Signing out has two parts: clearing the application's authentication data and visiting the provider to end its session. logout() clears local authentication before redirecting to the provider.
Inside any wrapped handler:
if (path === '/logout') auth.logout('/signed-out');The signed-out route should display the result without calling logout() again. Other session data, such as a shopping basket, is preserved.
Destination precedence is:
- The explicit argument to
logout(). - The value configured with
setReturnUri(). - The provider's deployment default.
auth.setReturnUri('/members/');
auth.logout('/signed-out');The explicit /signed-out destination wins. With neither setting the provider returns to its configured client URI with do=logout. The local user has already been cleared.
Keep destinations under application control; validate request-supplied routes and origins before using them.
auth.logout(new Uri('https://app.example.com/signed-out'));
// Alternatively: auth.logout(new URL('https://app.example.com/signed-out'));
auth.logout('?signed-out=1');The query-only form replaces the query on the current request URI. For /account?tab=security, it requests /account?signed-out=1, even if another return URI is configured.
The default redirect signal ends execution inside the handler; the adapter sends a 303 after saving. Before redirection, isLoggedIn() is false and getAuthUser() throws NotLoggedInException. Custom redirect handlers must preserve control flow.
Clearing only local data does not clear the provider session. Use logout() to visit the provider too.
Users with email equal to Authenticator.FAKE_EMAIL are logged out locally without a redirect. A fake user with another email follows ordinary provider logout. See Development and testing.
Continue with Provider links.
Authwave’s TypeScript client connects your Node.js, Express or Next.js application to an Authwave provider.