[keycloak-user] Poor/buggy TypeScript adapter implementation

Stian Thorgersen sthorger at redhat.com
Fri Apr 6 07:04:14 EDT 2018


As I mentioned on the JIRA there are official typescript definitions in the
official keycloak.js package - https://www.npmjs.com/package/keycloak-js.

Have you tried these? If there are issues in those fixes would be welcome.

On 6 April 2018 at 11:16, Marcel Német <Marcel.Nemet at gmail.com> wrote:

> At the moment, there are multiple projects on GitHub which try to bring
> advanced Keycloak functionality into angular 2+ projects.
>
> There are projects which are based on the official keycloak javascript
> adapter (these projects copy files from or import the official javascript
> adapter) for example :
> https://github.com/ssilvert/keycloak-schematic (works with angular 2+)
> and
> https://github.com/mauriciovigolo/keycloak-angular (works with angular
> 4.3+
> and provides the implementation for the great HttpInterceptor (angular
> 4.3+) in order to add bearer tokens to HTTP requests)
>
> Both of these projects are missing the implementation of Authorization
> flow, and it is not easy to implement this when one tries to use the
> official Keycloak javascript adapter with TypeScript. For example,
> KeycloakAuthorization returns undefined when constructed and does not
> return an observable after executing async HTTP request to
> /.well-known/uma-configuration .
>
> There is another project:
> https://github.com/ebondu/angular2-keycloak
>
> which is not using the official keycloak javascript adapter. Instead, the
> authors have rewritten the code from official JS adapter into TypeScript.
> It seems to address issues which I was not able to solve with the official
> javascript adapter. For example, it notifies the initialization of
> Authorization object (see
> https://github.com/ebondu/angular2-keycloak/blob/
> b8dd423fefc98305ac2f2f9efd1178020a8a2966/src/services/
> keycloak.auth.service.ts#L154
> ).
>
> But this project is not updated as often as the official javascript
> adapter. For example, it does not support uma2 which is coming with 4.0.0.
>
> I believe it would be good to invest some effort into making the basic
> keycloak javascript adapter working well with angular/typescript. There is
> clearly interest in building good libraries, but these have to be based on
> a working, official and updated basic adapter. One option would be to pull
> the code from https://github.com/ebondu/angular2-keycloak. Or endorse some
> working implementation for TypeScript.
>
> issue: https://issues.jboss.org/browse/KEYCLOAK-7021
>
> Best regards
>
> --
> Marcel Német
> marcel.nemet at gmail.com
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user


More information about the keycloak-user mailing list