Skip to content

Conversation

movinsilva
Copy link
Contributor

@movinsilva movinsilva commented Apr 22, 2024

Purpose

  • add me function
  • expose required functions from the package
  • expose required models from the package

Related Issues

Related PRs

Checklist

  • e2e cypress tests locally verified.
  • Manual test round performed and verified.
  • UX/UI review done on the final implementation.
  • Documentation provided. (Add links if there are any)
  • Unit tests provided. (Add links if there are any)
  • Integration tests provided. (Add links if there are any)

Security checks

Comment on lines 28 to 41
try {
baseUrl = (await AuthClient.getInstance().getDataLayer().getConfigData()).baseUrl;
accessToken = await AuthClient.getInstance().getAccessToken();
} catch (error) {
throw new AsgardeoUIException(
'JS_UI_CORE-ME-M-NF',
'Failed in getting the base URL and access token.',
error.stack,
);
}

if (!accessToken) {
throw new AsgardeoUIException('JS_UI_CORE-ME-M-IV', 'Access token is null.');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we extract this logic to a reusable function? Retrieving the access token is going to be reused by many methods I guess.

Ideally, it should be the end users responsibility to pass the correct payload and headers to getProfileInformation function. The SDK should not make token requests for each API call, IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the core SDK, only this function is getting the access token. So retrieving access token won't be reused.

End user will be accessing either a custom hook to get user information or will use the profile component directly. In these scenarios we cannot expect the the end user to pass any payload or headers, as it will degrade the user experience.

@pavinduLakshan pavinduLakshan merged commit 582b5fb into asgardeo:main Apr 30, 2024
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