Skip to content

Conversation

@swati354
Copy link
Collaborator

@swati354 swati354 commented Oct 31, 2025

  1. Adds a tokenStorage configuration option to allow users to choose between localStorage and sessionStorage for OAuth token storage, with sessionStorage as the secure default.
  2. Also implements a proper logout() method to clear all authentication state.

Motivation
Problem 1: Cross-Tab Token Persistence
With sessionStorage, OAuth tokens don't persist across browser tabs opened via target="_blank" in modern browsers.
Impact: Since sessionStorage isn’t shared across tabs, authentication tokens aren't available when a new page opens in a new tab, causing reauthentication or redirect issues.

Problem 2: SDK lacked a proper logout mechanism.

sessionStorage.removeItem('uipath_sdk_oauth_context');
sessionStorage.removeItem('uipath_sdk_code_verifier');
} catch (error) {
console.warn('Failed to clear OAuth context from session storage', error);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Raina451 @swati354 Something to ponder later. We need to maintain a style for any/all info/warn/error statements throughout the SDK

}

// Check if token is expired
if (this.isTokenExpired(tokenInfo)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not combine both conditions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants