-
Notifications
You must be signed in to change notification settings - Fork 243
Description
For which library do you need help?
native-federation
Question
Hello angular-architects!
We are exploring the use of keycloak-angular in Angular v20 applications with a Micro-Frontend architecture using @angular-architects/native-federation.
Problem observed:
Angular often reports errors such as:
NG0201: No provider found for Keycloak or issues similar to those described in mauriciovigolo/keycloak-angular#432
and mauriciovigolo/keycloak-angular#465.
These issues appear only in MFE contexts before skipping Keycloak libraries. Monolithic applications work as expected. From what we have observed, a common recommendation is to enable a single auth library or shared service, skip the Keycloak libraries from the federation configuration, and share authentication information through that channel.
Context / observations:
Keycloak was primarily designed for monolithic Angular applications.
Multiple GitHub issues (e.g., mauriciovigolo/keycloak-angular#432) indicate challenges when sharing keycloak-js or keycloak-angular across hosts and remotes.
Deprecations in v20 removed some services that previously allowed custom DI or singleton patterns. This limits the ways Keycloak can be initialized before bootstrapping the host and remote applications.
Questions:
- Is using keycloak-angular officially supported in Micro-Frontend architectures with Native Federation?
- If yes, what is the recommended pattern to ensure that a Keycloak instance is properly available in Angular’s injector for host and remotes?
- Is sharing keycloak-js or keycloak-angular as a singleton recommended or unsupported in these setups?
- Is there an official DI token (e.g., KEYCLOAK_INSTANCE) for this purpose in v20?
- Any official guidance or recommended patterns would be greatly appreciated.
References:
- Issue: Question: Keycloak with Module Federation mauriciovigolo/keycloak-angular#432
- Issue: MFE WEBPACK_IMPORTED_MODULE_5 is not a constructor mauriciovigolo/keycloak-angular#465
- Issue: Keycloak Angular Integration #736
- Blog: Micro Frontends with Angular and Native Federation
- Keycloak v20 release notes — deprecations affecting DI patterns: https://github.com/mauriciovigolo/keycloak-angular/releases
Any help or context is appreciated, thanks!