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

[Bug]: js console error from oauth4webapi.js #509

Open
dwradcliffe opened this issue Aug 27, 2024 · 2 comments · May be fixed by #512
Open

[Bug]: js console error from oauth4webapi.js #509

dwradcliffe opened this issue Aug 27, 2024 · 2 comments · May be fixed by #512
Assignees
Labels
bug Something isn't working

Comments

@dwradcliffe
Copy link
Contributor

dwradcliffe commented Aug 27, 2024

What happened?

I'm seeing this error in the js console, coming from the included oauth4webapi library.

"node_modules/@panva/oauth4webapi/build/index.js"

SyntaxError: Unexpected token 'export' (at oauth4webapi.js:91:1)

I believe this is because this file is a module which can't be included directly without using type="module" in the script tag. But angular doesn't support this because anything that is a module should be included in the main bundle.

So, where is this being used and is it actually working?

Flavor

Docker

Version

dev

@dwradcliffe dwradcliffe added the bug Something isn't working label Aug 27, 2024
@AnalogJ
Copy link
Member

AnalogJ commented Aug 28, 2024

Honestly my initial reaction was to say it's required for the callback redirect code in

import * as Oauth from '@panva/oauth4webapi';

and

https://github.com/fastenhealth/fasten-onprem/blob/7d0715755051d591bc94e873a75f43d3da4ba921/frontend/src/app/services/auth.service.ts

Git blame says it was added pretty early in development - 9c7504e

I think I had issues calling the Oauth functions without doing the script import. It could also be related to the crypto.subtle polyfill (for users who run Fasten on a custom domain, but without a valid cert. eg. health.local or health.internal)

I never had issues with this during development however. I'm surprised that you cant compile.

@dwradcliffe
Copy link
Contributor Author

Because it's imported in those places properly, I think it shouldn't be needed in the global namespace. I'll PR to remove it.

@dwradcliffe dwradcliffe linked a pull request Aug 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@dwradcliffe @AnalogJ and others