> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Logout # Package: headless # Namespace: AuthenticationService # Method link: https://dev.wix.com/docs/api-reference/business-management/headless/authentication/logout.md ## Introduction Terminates the member's session and clears authentication cookies. Returns the following: - `body`: HTML content for the logout response - `statusCode`: HTTP status code (200 for success, 302 for redirect) - `headers`: Array of key-value pairs including: - `Set-Cookie` headers to remove all session cookies - `Location` header (when `postLogoutRedirectUri` is provided, with 302 status) --- ## REST API ### Schema ``` Method: logout Description: Terminates the member's session and clears authentication cookies. Returns the following: - `body`: HTML content for the logout response - `statusCode`: HTTP status code (200 for success, 302 for redirect) - `headers`: Array of key-value pairs including: - `Set-Cookie` headers to remove all session cookies - `Location` header (when `postLogoutRedirectUri` is provided, with 302 status) URL: https://www.wixapis.com/v1/logout Method: GET Method parameters: query param name: clientId | type: clientId | description: Client identifier for the logout request. Identifies the application or client initiating the logout. query param name: postLogoutRedirectUri | type: postLogoutRedirectUri | description: URL to redirect to after logout. Optional redirect destination after the logout process completes. Return type: RawHttpResponse - name: body | type: bytes | description: - name: statusCode | type: integer | description: - name: headers | type: array | description: - name: key | type: string | description: - name: value | type: string | description: ``` ### Examples ### Log out a member Logs out the current member and redirects to a specified URL ```curl curl -X POST \ 'https://www.wixapis.com/authentication/v1/logout' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "postLogoutRedirectUri": "https://mysite.com/goodbye", "clientId": "12345678-1234-1234-1234-123456789012" }' ``` ### Log out a member Logs out the current member ```curl # Example 1: Simple logout curl -X GET \ 'https://www.wixapis.com/authentication/v1/logout' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.headless.AuthenticationService.logout(options) Description: Terminates the member's session and clears authentication cookies. Returns the following: - `body`: HTML content for the logout response - `statusCode`: HTTP status code (200 for success, 302 for redirect) - `headers`: Array of key-value pairs including: - `Set-Cookie` headers to remove all session cookies - `Location` header (when `postLogoutRedirectUri` is provided, with 302 status) Method parameters: param name: options | type: LogoutOptions none - name: postLogoutRedirectUri | type: string | description: URL to redirect to after logout. Optional redirect destination after the logout process completes. - name: clientId | type: string | description: Client identifier for the logout request. Identifies the application or client initiating the logout. Return type: PROMISE - name: body | type: bytes | description: - name: statusCode | type: integer | description: - name: headers | type: array | description: - name: key | type: string | description: - name: value | type: string | description: ``` ### Examples ### logout ```javascript import { authentication } from '@wix/identity'; async function logout(options) { const response = await authentication.logout(options); }; ``` ### logout (with elevated permissions) ```javascript import { authentication } from '@wix/identity'; import { auth } from '@wix/essentials'; async function myLogoutMethod(options) { const elevatedLogout = auth.elevate(authentication.logout); const response = await elevatedLogout(options); } ``` ### logout (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { authentication } from '@wix/identity'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { authentication }, // Include the auth strategy and host as relevant }); async function logout(options) { const response = await myWixClient.authentication.logout(options); }; ``` ---