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 requested review from horner and wreiske October 22, 2024 20:42
@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

Copy link
Member

Choose a reason for hiding this comment

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

@abroa01 any progress on these?

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

Copy link
Member

Choose a reason for hiding this comment

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

@abroa01 any progress on this?

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

Copy link
Member

Choose a reason for hiding this comment

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

@abroa01 any progress on this?

@wreiske
Copy link
Member

wreiske commented Nov 27, 2024

@abroa01 there are several outstanding code review changes from @horner that are not marked as resolved. Can you take a look at these?

It also looks like the MIE api code is duplicated twice in the repo.

once here: https://github.com/mieweb/mieapi-js/pull/8/files#diff-a239f18ba4318d1f80aed3fa1d58ca19d3e51e4923091aeb682b25df3b521c44R1
second here: https://github.com/mieweb/mieapi-js/pull/8/files#diff-981b8cdc80ab4ddcbfc126dfb1edc4a4aa06f6ab9fedc4b5b675de6934d8e064R1

There's also still a dependency here for the BlueHive refresh token... I'm not sure if we want to use this in our official "MIE" api and we should strongly push for using something like oauth or jwt / another form of authentication for our official npm package.

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