DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
logout(
orgIdentifiers?):Promise<LogoutResponse>
Ends the session for the logged-in user and user will wait for promise resolution
• orgIdentifiers?: string[]
An array of org URLs to logout. If not provided, this logs out of all orgs.
Promise<LogoutResponse>
A promise that resolves with logout status, message, and org states.
1const result = await logout(['https://org1.my.salesforce.com']);
2console.log(result.status); // 'SUCCESS', 'PARTIAL_SUCCESS', or 'FAILURE'
3console.log(result.message); // Detailed message about logout results
4console.log(result.orgStates); // Map of org states after logoutIn multi-org scenarios, you can logout from specific orgs or all orgs:
1import {logout, Status} from '@salesforce/analytics-embedding-sdk';
2
3// Logout from specific orgs
4const response = await logout([
5 'https://org1.lightning.force.com',
6 'https://org2.lightning.force.com'
7]);
8
9// Logout from all orgs (omit the parameter)
10const allLogoutResponse = await logout();
11
12// Check logout status
13if (response.status === Status.SUCCESS) {
14 console.log('All specified orgs logged out successfully');
15} else if (response.status === Status.PARTIAL_SUCCESS) {
16 console.log('Some orgs logged out successfully');
17 // Check individual org states
18 response.orgStates?.forEach((state, orgUrl) => {
19 console.log(`${orgUrl}: ${state.state}`);
20 });
21}Note: Invalid orgURLs are silently ignored. Only valid orgs that were previously initialized will be logged out.