Skip to content

User and organization data

vimOS.sessionContext provides both information about the Vim Connect user and methods for interacting with this data. This includes details collected during the User and/or Clinic onboarding process to Vim Connect, with the exception of the EHR username.

ts
interface SessionContext {
  sessionId: string;
  user: User;
  organization: Organization;
  ehrType?: string;
  getIdToken: Promise<GetIdTokenResponse>;
}

required permissions

WARNING

Your application will only receive information for the entities it declared read access for under the 'User Details' section in the Developer Console; Entities for which read access wasn't declared will always be undefined.

sessionId

vimOS.sessionContext.sessionId is a unique identifier that represents a unique user session in Vim Hub. It is generated when Vim Hub loads and is refreshed each time there is a new Vim Hub session.

User

vimOS.sessionContext.user holds information about the user that is logged in to the EHR and Vim:

ts
export interface user {
  identifiers?: {
    id: string;
    ehrUsername: string;
    npi: string
  };
  demographics?: {
    firstName: string;
    lastName: string;
  };
  contactInfo?: {
    email: string;
  };
}
ts
const user = {
  identifiers: {
    id: 203948209842098402,
    ehrUsername: 'john9328',
    npi: '123456',
  },
  demographics: {
    firstName: 'John',
    lastName: 'Pisoto',
  },
  contactInfo: {
    email: '[email protected]',
  },
};

Organization

vimOS.sessionContext.organization contains details about the organization to which the currently logged-in user belongs.

ts
export interface Organization {
  identifiers?: {
    id: number;
    name: string;
    tin: string;
  };
}
ts
const organization = {
  identifiers: {
    id: 1923,
    name: 'Medical group associates',
    tin: '123456',
  },
};

ehrType

vimOS.sessionContext.ehrType holds the name of the EHR the user is currently using.

getIdToken

ts
export interface GetIdTokenResponse {
  idToken: string;
}

vimOS.sessionContext.getIdToken() returns the current session ID token, which can be used for Single Sign-On (SSO) flows as described in the Application SSO section.