SessionManager

Class

The SessionManager is used to manage user sign in sessions.

Methods

clearSessions
clearSessions(): void

Clear all sessions

Returns 
void
getMainSession
getMainSession(): UserSession

Return main session.

The main session is session of the portal that the app connects to.

Returns 
UserSession
getSessionByUrl
getSessionByUrl(urlstring): UserSession

Return session by url.

Parameters
  • urlstring
Returns 
UserSession
getSessions
getSessions(): UserSession[]

Return all sessions.

Returns 
UserSession[]
handleAuthError
handleAuthError(errorany, popupboolean): Promise<UserSession>

When you need to handle the error caused by sign in, you can catch the error and call this method. This method will try to sign in to get a new session.

Parameters
  • errorany
  • popupboolean = true
Returns 
Promise<UserSession>
removeSession
removeSession(sessionUserSession): boolean

Remove the session from session manager.

Parameters
  • sessionUserSession
Returns 
boolean
signIn
signIn(fromUrlstring, popupboolean, desUrlstring): Promise<UserSession>

Start OAuth sign in flow and return the user session.

Parameters
  • fromUrlstring = '/'

    The page you start sign in

  • popupboolean = true

    If 'true', the window will popup, or, it will redirect to sign in page

  • desUrlstring = ...

    The url you want to sign in

Returns 
Promise<UserSession>
signOut
signOut(): void

Sign out from main portal.

Returns 
void
getInstance static
getInstance(): SessionManager

Get singleton instance.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.