Keycloak-angular: no exported member 'KeycloakConfig'.

Created on 28 Jul 2020  路  6Comments  路  Source: mauriciovigolo/keycloak-angular

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search for issues before submitting
- [ ] feature request

Versions.

keycloak-angular: 7.3.1 --> 8.0.1
angular: 10 (recently upgraded from 8.2, but had successful builds after upgrade to 10)
keycloak: Believed to be N/A for current issue.

Repro steps.

  1. Write application code.
  2. Start on version 7.3.1 of keycloak angular
  3. Run npm outdated and note that Latest is 8.0.1
  4. Change package.json's dependency from "keycloak-angular": "7.3.1" to "keycloak-angular": "8.0.1"
  5. Run npm install
  6. Run ng test

    Sample code snippets
import { KeycloakConfig } from 'keycloak-angular';

@Injectable()
export class AppConfig {
  static keycloak: KeycloakConfig;
}
export class KeycloakCallsService {
  readonly baseApiUrl: string = `${AppConfig.keycloak.url}/admin/realms/${AppConfig.keycloak.realm}`;



md5-0e5cd84c99dd397adce97cc93e910cf5



export class MockAppConfig {
    static keycloak: KeycloakConfig = {
      url: 'testKeycloakUrl',
      realm: 'testKeycloakRealm',
      clientId: 'testKeycloakClientId'
    };
  }



md5-cca096e783750868e121840871489575



ERROR in src/app/application/app.config.spec.ts:1:10 - error TS2305: Module '"../../../node_modules/keycloak-angular/keycloak-angular"' has no exported member 'KeycloakConfig'.

1 import { KeycloakConfig } from 'keycloak-angular';
           ~~~~~~~~~~~~~~
src/app/application/app.config.ts:3:10 - error TS2305: Module '"../../../node_modules/keycloak-angular/keycloak-angular"' has no exported member 'KeycloakConfig'.

3 import { KeycloakConfig } from 'keycloak-angular';
           ~~~~~~~~~~~~~~

Desired functionality.

Keycloak-Angular 8.0.1 works with our application so that we can remain up-to-date with functionality and security. If there are release notes regarding the upgrade from 7 to 8, I haven't been able to find them yet.

Question

Most helpful comment

It seems that the KeycloakConfig interface was defined within this package in 7.3.1 but at least of 8.0.1, while an identically-named interface is still used, it is instead imported from the keylcoak-js adapter node module.

To get tests to pass, I changed

import { KeycloakConfig } from 'keycloak-angular';

to

import { KeycloakConfig } from 'keycloak-js';

However, other parts of the application that depend on Keycloak fail to work afterthis.

All 6 comments

It seems that the KeycloakConfig interface was defined within this package in 7.3.1 but at least of 8.0.1, while an identically-named interface is still used, it is instead imported from the keylcoak-js adapter node module.

To get tests to pass, I changed

import { KeycloakConfig } from 'keycloak-angular';

to

import { KeycloakConfig } from 'keycloak-js';

However, other parts of the application that depend on Keycloak fail to work afterthis.

This is indeed a breaking change we introduced in version 8. These types have since been added to keycloak-js and should be imported there.

Are there release notes or a migraiton guide regarding this?

@lrxw It seems this is the PR when the breaking change was introduced. (KeycloakConfig -> Keycloak.KeycloakConfig and Keycloak >= 10)

There doesn't seem to be a migration guide, but there is _some_ reference to changes made, including in a change to a comment within the PR's changes. If we figure out how to do it, let's post back here? 馃し

I dug in the PRs on the Keycloak repo and found a discussion here: https://github.com/keycloak/keycloak/pull/6400

And some pertinent discussion may be here: https://lists.jboss.org/pipermail/keycloak-dev/2019-November/012808.html

The migration step here is to import the type from keycloak-js instead as mentioned in @mrsegen comment:

import { KeycloakConfig } from 'keycloak-js';

There are also breaking changes in keycloak-js which remove the credentials option, this is intentional as these type of clients are not secure. If you are experiencing issues around this make sure to switch to a public client. For more information see:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

its-vincesanity picture its-vincesanity  路  4Comments

jdmaguire picture jdmaguire  路  3Comments

livthomas picture livthomas  路  4Comments

arratejasvi picture arratejasvi  路  4Comments

4javier picture 4javier  路  3Comments