Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/implement webchart sso #8

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

abroa01
Copy link
Collaborator

@abroa01 abroa01 commented Oct 22, 2024

I have made the following changes -

  • moved the not required dependencies to devDep in package.json
  • corrected the format of this npm package to handle the connectToken received from Webchart Login

@abroa01 abroa01 self-assigned this Oct 22, 2024
@abroa01
Copy link
Collaborator Author

abroa01 commented Oct 22, 2024

Hi @wreiske,

I have made the changes to the npm package, Request you to kindly merge the PR.
I have tested the npm in my local and it is working fine.

sessionCookie,
connectTokenRefreshedAt: new Date(),
expiration: new Date(new Date().getTime() + 5 * 60 * 1000),
});
Copy link
Member

Choose a reason for hiding this comment

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

Magic numbers

src/MIEApi.js Outdated

const getCookieResponse = await axios.get(`${this.baseUrl}?f=wcrelease&json`, {
headers: {
'User-Agent': 'BlueHive AI (Get x-db_name)',
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this?

Copy link
Member

Choose a reason for hiding this comment

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

We have a default of mieapi but allow for an override

src/MIEApi.js Outdated

const response = await axios.get(refreshUrl, {
headers: {
'User-Agent': 'BlueHive AI (Refresh Connection)',
Copy link
Member

Choose a reason for hiding this comment

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

Dup?

Copy link
Member

Choose a reason for hiding this comment

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

Also, please do not use this user agent. You should call it something like mieapi and possibly include the version string for the NPM version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed it to mieapi and included the npm version

image

if (cachedSession && cachedSession.sessionCookie) {
const now = new Date();
const timeElapsed = now - new Date(cachedSession.connectTokenRefreshedAt);
if (timeElapsed < 5 * 60 * 1000) {
Copy link
Member

Choose a reason for hiding this comment

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

Magic code not linked to the other

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.

3 participants