You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across this issue while working on a mobile app using Capacitor. The current implementation of keycloak-js is hard to extend and the code is probably also hard to maintain. For Capacitor there is an alternative implementation of keycloak-js: https://github.com/JohannesBauer97/keycloak-ionic because a lot of functions would need to be copied to. From this experience I started this and ported keycloak-js to typescript https://github.com/footageone/keycloak-js/tree/main/src
It's now modular and could also be release as an ESM version. It also includes the capacitor adapters. But actually I would suggest to create separate packages for every adapter, as each adapter has different requirements.
There is still a lot of work to improve the keycloak-js code make it up to date.
I'm all for revamping the JS adapter, both in terms of how it is implemented/built, but also would like to see some improvements on its internals/APIs as well.
Would probably make sense to start it as a completely new project (separate git repo), which will make it possible to break the API and change how it behaves without worrying about backwards compatiblity.
First step here is really to start on a more detailed proposal. If someone from the community wants to take that on that'd be great, otherwise this will end up in the backlog for a while.
It's also quite relevant to reassess the security around a SPA integration. There's different approaches mentioned in oauth best practices, and we only support the least secure approach today. There's also some techniques that can be used to make it more secure with the current approach by sandboxing the tokens more (if I don't remember incorrectly it's called service workers).
Final point to make here is that we should also review if there are better oauth/oidc libraries out there now that can either be used as is, or be used within a thinner wrapper library from our end.
Yes, we certainly need to work on a proposal taking more modern standards into account. I am absolutely in favor of looking around to see if there are existing projects out there that can provide value in this regard (suggestions welcome).
Maybe it would also help a lot to give some guidelines. I wanted to use a generic OAuth library with Capacitor but got somehow lost in terminology and in understanding what do I need to provide for the configuration. I often see me confronted with the problem, that example configurations for Google, Azure, Auth0 but rarely for Keycloak.
Maybe it's a good idea to check how existing solutions can be used.
Well, from my experience of working with keycloak-ionic there are two core parts in working with keycloak-js is generating the URLs and parsing the response. As one of the few still maintained generic solutions I found https://github.com/salte-auth/salte-auth
But as I see the handlers expect a full response with the tokens.
For me currently the hardest part is to understand how parsing of the data and retrieving consecutive requests in the callbacks work and how SSO checks and the silent renewal of tokens should work. Probably having this parts split into small modules would make it a lot easier to create implementations for different libraries.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I came across this issue while working on a mobile app using Capacitor. The current implementation of keycloak-js is hard to extend and the code is probably also hard to maintain. For Capacitor there is an alternative implementation of keycloak-js: https://github.com/JohannesBauer97/keycloak-ionic because a lot of functions would need to be copied to. From this experience I started this and ported keycloak-js to typescript https://github.com/footageone/keycloak-js/tree/main/src
It's now modular and could also be release as an ESM version. It also includes the capacitor adapters. But actually I would suggest to create separate packages for every adapter, as each adapter has different requirements.
There is still a lot of work to improve the keycloak-js code make it up to date.
All reactions
Replies: 2 comments · 7 replies
Uh oh!
There was an error while loading. Please reload this page.
@jonkoops FIY
All reactions
Uh oh!
There was an error while loading. Please reload this page.
I'm all for revamping the JS adapter, both in terms of how it is implemented/built, but also would like to see some improvements on its internals/APIs as well.
Would probably make sense to start it as a completely new project (separate git repo), which will make it possible to break the API and change how it behaves without worrying about backwards compatiblity.
All reactions
Uh oh!
There was an error while loading. Please reload this page.
First step here is really to start on a more detailed proposal. If someone from the community wants to take that on that'd be great, otherwise this will end up in the backlog for a while.
It's also quite relevant to reassess the security around a SPA integration. There's different approaches mentioned in oauth best practices, and we only support the least secure approach today. There's also some techniques that can be used to make it more secure with the current approach by sandboxing the tokens more (if I don't remember incorrectly it's called service workers).
Final point to make here is that we should also review if there are better oauth/oidc libraries out there now that can either be used as is, or be used within a thinner wrapper library from our end.
All reactions
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Yes, we certainly need to work on a proposal taking more modern standards into account. I am absolutely in favor of looking around to see if there are existing projects out there that can provide value in this regard (suggestions welcome).
All reactions
Uh oh!
There was an error while loading. Please reload this page.
Maybe it would also help a lot to give some guidelines. I wanted to use a generic OAuth library with Capacitor but got somehow lost in terminology and in understanding what do I need to provide for the configuration. I often see me confronted with the problem, that example configurations for Google, Azure, Auth0 but rarely for Keycloak.
Maybe it's a good idea to check how existing solutions can be used.
For example
All reactions
Uh oh!
There was an error while loading. Please reload this page.
I am a big fan of the work of Manfred on
angular-oauth2-oidc, unfortunately it is largely Angular specific.All reactions
Uh oh!
There was an error while loading. Please reload this page.
Well, from my experience of working with keycloak-ionic there are two core parts in working with keycloak-js is generating the URLs and parsing the response. As one of the few still maintained generic solutions I found https://github.com/salte-auth/salte-auth
But as I see the handlers expect a full response with the tokens.
For me currently the hardest part is to understand how parsing of the data and retrieving consecutive requests in the callbacks work and how SSO checks and the silent renewal of tokens should work. Probably having this parts split into small modules would make it a lot easier to create implementations for different libraries.
All reactions