No cookies after login

we started a migration branch to work with keycloak-js and the keycloak-angular wrapper in our frontend client. We initialize the keycloak service as as follows:

export class ConfigInitService {

    private config: any;
    private httpClient: HttpClient;
    constructor(private handler: HttpBackend) {
      this.httpClient = new HttpClient(handler);

    public getConfig(): Observable<any> {
        return this.httpClient
            .get(this.getConfigFile(), {
                observe: 'response',
                catchError((error) => {
                    return of(null)
                mergeMap((response) => {
                    if (response && response.body) {
                        this.config = response.body;
                        return of(this.config);
                    } else {
                        return of(null);

    private getConfigFile(): string {
        return environment.configFile
export function initializeKeycloak(
    keycloak: KeycloakService,
    configService: ConfigInitService
) {
    return () =>
                switchMap<any, any>((config) => {
                    return fromPromise(keycloak.init({
                        config: {
                            url: config['KEYCLOAK_URL'],
                            realm: config['KEYCLOAK_REALM'],
                            clientId: config['KEYCLOAK_CLIENT_ID'],

                        initOptions: {
                            onLoad: 'login-required',
                            checkLoginIframe: false,
                        authorizationHeaderName: 'Authorization',
                        bearerPrefix: 'Bearer ',
                        enableBearerInterceptor: true,

Inside app.config.ts we instantiate the service as followed:

      provide: APP_INITIALIZER,
      useFactory: initializeKeycloak,
      multi: true,
      deps: [KeycloakService, ConfigInitService],
    KeycloakService, // without this the application is throwing a NullPointerInjection

This was used inside another project and it seems to work pretty fine there, but for some reason after logging in our project we receive the error that no cookie was found.

(original image by wei wen - javascript - Why after login keycloak display "Cookie not found. Please make sure cookies are enabled in your browser." - Stack Overflow)

This is the deployed state on our test server. When running locally, everything works fine. On the server, Keycloak and the application are running on 2 different domains. We are receiving no errors except for a 400-bad request after logging in… Unfortunately we also have no chance to look into the Keycloak configuration.

Does anyone know what could cause this problem?

Angular 17.3.11
keycloak-angular 15.3.0
keycloak-js 25.0.1