getUserInfo

Overview

Function that allows for the retrieval of user information associated with a token if one exists. The information that is provided at time of writing is as follows:

  • businessPhones

  • displayName

  • givenName

  • id

  • jobTitle

  • Mail

  • mobilePhone

  • officeLocation

  • preferredLanguage

  • surname

  • userPrincipleName

Example : Default usage
import { getUserInfo } from '@ska-telescope/ska-login-page';

...

const [userInfo, setUserInfo] = React.useState<string | null | undefined>(null);
getUserInfo(accessToken).then((response) => {
   setUserInfo(response);
});

...

<p>
     <strong>ID</strong> {userInfo.displayName}
</p>
Properties

Property

Type

Required

Notes

userToken

string

No

IF present, the token will be used, otherwise it will obtain the token of the logged in user.