-
Notifications
You must be signed in to change notification settings - Fork 3
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
Import issue of oidc-client in vue.js project #18
Comments
Hi @rmeissn! Until IdentityModel/oidc-client-js/issues/960 is fixed, I created the workaround branch global-oidc. Can you please check if this works with Vue? I removed all the internal imports of oidc-client and now rely on a (admittedly, dirty) direct reference. if this works for you, I can release a version 3.x and continue working on the shadow DOM styling. 😜 |
Sorry for the delay. |
Did you import the openidconnect library within your top-level HTML? Because then UserManager should be defined on global. |
I've tried for a whole day to import the library globally (browser) and read a lot of vue, various library and webpack documentation about this. Basically each tipp I found was: avoid this scenario; use another library; rewrite it as a proper module; don't use the functionality. The whole webpack & vue community wants to avoid this scenario (for various reasons) and implemented a lot of obstacles to keep people from doing this. Actually I found no way to import it globally, except from copying the file to a served folder - which can't be the solution as it is the starting point of a dependency nightmare - see my stackoverflow question: https://stackoverflow.com/questions/59172786/import-and-evaluate-a-node-modules-script-globally-browser-in-a-vue-project-c . Furthermore I'm not sure if this might work at all, as the file includes a lot of webpack instructions itself. Importing it globally solved the ReferenceError, but I'm being anguish about this solution. I've noticed that the issue you've mentioned earlier is not resolved, but has a merged PR. Could you please have a look if this resolves the problem? |
Are there any news about this issue? |
I imported the button as described and used it in my vue.js application (Vue 2.6).
Unfortunately the button isn't working as the import of the underlying oidc-client fails.
In your code you imported the lib on line 11 by executing
import 'oidc-client';
(side-effect import).On line 164 you're using an imported value from this lib via
this._manager = new UserManager(settings);
My browser (Firefox 69) complains about
UserManager not defined
If I change these two lines to:
it works as expected.
The text was updated successfully, but these errors were encountered: