x)- [x] bug report -> please search for issues before submitting
- [ ] feature request
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.
npm outdated and note that Latest is 8.0.1"keycloak-angular": "7.3.1" to "keycloak-angular": "8.0.1"npm installng testimport { 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';
~~~~~~~~~~~~~~
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.
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:
Most helpful comment
It seems that the
KeycloakConfiginterface was defined within this package in7.3.1but at least of8.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
to
However, other parts of the application that depend on Keycloak fail to work afterthis.