Hi all!
The readme says:
"A best practice is to load the JavaScript adapter directly from Keycloak Server as it will automatically be updated when you upgrade the server."
Question 1:
How do I do this in an angular 8 application? Just add this at the end of index.html?
<script src="https://my-keycloak.com/auth/js/keycloak.js"></script>
Question 2:
What about package.json? Do I have to add "keycloak-js" there as well next to "keycloak-angular"? But then I would have "keycloak-js" in my build-package as well as the loaded script from index.html... Which one will win during runtime?
Hi @michaelhunziker,
The topic about how to handle keycloak-js on the library's README is not clear enough, I'm sorry, I will improve it. The issue #146 is also related to this lack of info.
This is not the way to handle the keycloak-js library for Angular apps. You will have to install the keycloak-js library by using npm or yarn.
The idea here is that you need to know what version comes with your Keycloak or Single SignOn server. For Keycloak is easier as the keycloak-js will follow the keycloak version. For example: keycloak 4.8.0 will have a [email protected] correspondent version.
For RH-SSO I recommend to look at the release documentation or taking or at the server dependencies.
It was answered in the previous question.
If you have any other doubts, don麓t hesitate to contact me.
Regards,
Hi @mauriciovigolo ,
I'm just looking for confirmation on the above as it's not 100% clear to me:
1) There is no way to load the keycloak Javascript adapter from the keycloak server, you must use the npm?
2) As a result when you update the keycloak server you must also update the keycloak-js npm?
Thanks.
@angular101
There is no way to load the keycloak Javascript adapter from the keycloak server, you must use the npm?
Yes, when building your Angular app you must have keycloak-js and keycloak-angular installed in order for things to work correctly. You can do this through npm install --save keycloak-angular@latest keycloak-js@latest
As a result when you update the keycloak server you must also update the keycloak-js npm?
It is always recommended to use the same version of keycloak-js as the version of Keycloak you are using. Although there is some level of compatibility between versions, I would not assume this to always be the case as the versions are only tested together by the Keycloak team.
@jonkoops thanks for confirming. This is a great project and very much appreciated.
I will close this issue as the question has been answered.