Why angular is not recognizing if a user is logged in with keycloak?
So i'm trying to set up a sso system with keycloak on my angular app.
I have downloaded the keycloak library keycloak-angular@4.0.2, setted up a keycloak server at localhost:8080/auth, added the keycloak.json on the root of the app, that keycloak made for me:
"realm": "my-app",
"auth-server-url": "http://localhost:8080/auth",
"ssl-required": "external",
"resource": "my-app",
"public-client": true,
"confidential-port": 0
Also I added the keycloak initi function in the main.ts:
import enableProdMode from '@angular/core';
//....some other import....
import KeycloakService from 'keycloak-angular';
var injector = ReflectiveInjector.resolveAndCreate([KeycloakService]);
var keycloak = injector.get(KeycloakService)
if (environment.production)
enableProdMode();
keycloak.init()
.then(() => platformBrowserDynamic().bootstrapModule(AppModule))
.catch(e =>
console.error(e);
);
Now, if i try to make a registration page, someting like this:
export class registration implements OnInit
constructor(keycloak:KeycloakService)
keycloak.register();
ngOnInit()
it works and sends me to a registration page and if i create an account it apears in the keycloak server.
BUT... even if i am not logged in with any account it lets me access any page, also, if i try :
keycloak.isLoggedIn().then(() => console.log("logged"), ()=>console.log("Not logged"));
The result is "logged", but if i try:
keycloak.loadUserProfile();
Then it says
The user profile was not loaded as the user is not logged in.
I can't understand how it works, am i missing someting?
So my question is:
-How do i prevent pages to show if i am not logged in?
-how do a make a user log and stay logged and angular to recognize who is logged and hwo is not.
Sorry if the question is stupid or the text doesn't matck this site best practices, i'm new around here.
thank you all!
UPDATE:
As asked i'm adding app.module.ts
import BrowserModule, HAMMER_GESTURE_CONFIG from '@angular/platform-browser';
import NgModule, APP_INITIALIZER from '@angular/core';
import TranslateModule from '@ngx-translate/core';
import HttpClientModule from '@angular/common/http';
import KeycloakService, KeycloakAngularModule from 'keycloak-angular';
import initializer from './utils/app-init';
import AppComponent from './app.component';
import AppRoutingModule from './app-routing.module';
import AuthenticationModule from './core/auth/authentication.module';
import NgxPermissionsModule from 'ngx-permissions';
import LayoutModule from './content/layout/layout.module';
import PartialsModule from './content/partials/partials.module';
import CoreModule from './core/core.module';
import AclService from './core/services/acl.service';
import LayoutConfigService from './core/services/layout-config.service';
import MenuConfigService from './core/services/menu-config.service';
import PageConfigService from './core/services/page-config.service';
import UserService from './core/services/user.service';
import UtilsService from './core/services/utils.service';
import ClassInitService from './core/services/class-init.service';
import NgbModule from '@ng-bootstrap/ng-bootstrap';
import BrowserAnimationsModule from '@angular/platform-browser/animations';
import GestureConfig, MatProgressSpinnerModule from '@angular/material';
import OverlayModule from '@angular/cdk/overlay';
import MessengerService from './core/services/messenger.service';
import ClipboardService from './core/services/clipboard.sevice';
import PERFECT_SCROLLBAR_CONFIG, PerfectScrollbarConfigInterface from 'ngx-perfect-scrollbar';
import LayoutConfigStorageService from './core/services/layout-config-storage.service';
import LogsService from './core/services/logs.service';
import QuickSearchService from './core/services/quick-search.service';
import SubheaderService from './core/services/layout/subheader.service';
import HeaderService from './core/services/layout/header.service';
import MenuHorizontalService from './core/services/layout/menu-horizontal.service';
import MenuAsideService from './core/services/layout/menu-aside.service';
import LayoutRefService from './core/services/layout/layout-ref.service';
import SplashScreenService from './core/services/splash-screen.service';
import DataTableService from './core/services/datatable.service';
import 'hammerjs';
import AppAuthGuardComponent from './utils/keycloak/app-auth-guard/app-auth-guard.component';
import KEYCLOAK_HTTP_PROVIDER from './utils/keycloak/keycloak.http';
const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface =
// suppressScrollX: true
;
@NgModule(
declarations: [AppComponent, AppAuthGuardComponent],
imports: [
BrowserAnimationsModule,
BrowserModule,
AppRoutingModule,
HttpClientModule,
LayoutModule,
PartialsModule,
CoreModule,
OverlayModule,
AuthenticationModule,
NgxPermissionsModule.forRoot(),
NgbModule.forRoot(),
TranslateModule.forRoot(),
MatProgressSpinnerModule,
KeycloakAngularModule,
],
providers: [
AclService,
LayoutConfigService,
LayoutConfigStorageService,
LayoutRefService,
MenuConfigService,
PageConfigService,
UserService,
UtilsService,
ClassInitService,
MessengerService,
ClipboardService,
LogsService,
QuickSearchService,
DataTableService,
SplashScreenService,
KeycloakService,
KEYCLOAK_HTTP_PROVIDER,
provide: PERFECT_SCROLLBAR_CONFIG,
useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
,
provide: APP_INITIALIZER,
useFactory: initializer,
multi: true,
deps: [KeycloakService]
,
// template services
SubheaderService,
HeaderService,
MenuHorizontalService,
MenuAsideService,
provide: HAMMER_GESTURE_CONFIG,
useClass: GestureConfig
],
bootstrap: [AppComponent]
)
export class AppModule
javascript angular single-sign-on keycloak
add a comment |
So i'm trying to set up a sso system with keycloak on my angular app.
I have downloaded the keycloak library keycloak-angular@4.0.2, setted up a keycloak server at localhost:8080/auth, added the keycloak.json on the root of the app, that keycloak made for me:
"realm": "my-app",
"auth-server-url": "http://localhost:8080/auth",
"ssl-required": "external",
"resource": "my-app",
"public-client": true,
"confidential-port": 0
Also I added the keycloak initi function in the main.ts:
import enableProdMode from '@angular/core';
//....some other import....
import KeycloakService from 'keycloak-angular';
var injector = ReflectiveInjector.resolveAndCreate([KeycloakService]);
var keycloak = injector.get(KeycloakService)
if (environment.production)
enableProdMode();
keycloak.init()
.then(() => platformBrowserDynamic().bootstrapModule(AppModule))
.catch(e =>
console.error(e);
);
Now, if i try to make a registration page, someting like this:
export class registration implements OnInit
constructor(keycloak:KeycloakService)
keycloak.register();
ngOnInit()
it works and sends me to a registration page and if i create an account it apears in the keycloak server.
BUT... even if i am not logged in with any account it lets me access any page, also, if i try :
keycloak.isLoggedIn().then(() => console.log("logged"), ()=>console.log("Not logged"));
The result is "logged", but if i try:
keycloak.loadUserProfile();
Then it says
The user profile was not loaded as the user is not logged in.
I can't understand how it works, am i missing someting?
So my question is:
-How do i prevent pages to show if i am not logged in?
-how do a make a user log and stay logged and angular to recognize who is logged and hwo is not.
Sorry if the question is stupid or the text doesn't matck this site best practices, i'm new around here.
thank you all!
UPDATE:
As asked i'm adding app.module.ts
import BrowserModule, HAMMER_GESTURE_CONFIG from '@angular/platform-browser';
import NgModule, APP_INITIALIZER from '@angular/core';
import TranslateModule from '@ngx-translate/core';
import HttpClientModule from '@angular/common/http';
import KeycloakService, KeycloakAngularModule from 'keycloak-angular';
import initializer from './utils/app-init';
import AppComponent from './app.component';
import AppRoutingModule from './app-routing.module';
import AuthenticationModule from './core/auth/authentication.module';
import NgxPermissionsModule from 'ngx-permissions';
import LayoutModule from './content/layout/layout.module';
import PartialsModule from './content/partials/partials.module';
import CoreModule from './core/core.module';
import AclService from './core/services/acl.service';
import LayoutConfigService from './core/services/layout-config.service';
import MenuConfigService from './core/services/menu-config.service';
import PageConfigService from './core/services/page-config.service';
import UserService from './core/services/user.service';
import UtilsService from './core/services/utils.service';
import ClassInitService from './core/services/class-init.service';
import NgbModule from '@ng-bootstrap/ng-bootstrap';
import BrowserAnimationsModule from '@angular/platform-browser/animations';
import GestureConfig, MatProgressSpinnerModule from '@angular/material';
import OverlayModule from '@angular/cdk/overlay';
import MessengerService from './core/services/messenger.service';
import ClipboardService from './core/services/clipboard.sevice';
import PERFECT_SCROLLBAR_CONFIG, PerfectScrollbarConfigInterface from 'ngx-perfect-scrollbar';
import LayoutConfigStorageService from './core/services/layout-config-storage.service';
import LogsService from './core/services/logs.service';
import QuickSearchService from './core/services/quick-search.service';
import SubheaderService from './core/services/layout/subheader.service';
import HeaderService from './core/services/layout/header.service';
import MenuHorizontalService from './core/services/layout/menu-horizontal.service';
import MenuAsideService from './core/services/layout/menu-aside.service';
import LayoutRefService from './core/services/layout/layout-ref.service';
import SplashScreenService from './core/services/splash-screen.service';
import DataTableService from './core/services/datatable.service';
import 'hammerjs';
import AppAuthGuardComponent from './utils/keycloak/app-auth-guard/app-auth-guard.component';
import KEYCLOAK_HTTP_PROVIDER from './utils/keycloak/keycloak.http';
const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface =
// suppressScrollX: true
;
@NgModule(
declarations: [AppComponent, AppAuthGuardComponent],
imports: [
BrowserAnimationsModule,
BrowserModule,
AppRoutingModule,
HttpClientModule,
LayoutModule,
PartialsModule,
CoreModule,
OverlayModule,
AuthenticationModule,
NgxPermissionsModule.forRoot(),
NgbModule.forRoot(),
TranslateModule.forRoot(),
MatProgressSpinnerModule,
KeycloakAngularModule,
],
providers: [
AclService,
LayoutConfigService,
LayoutConfigStorageService,
LayoutRefService,
MenuConfigService,
PageConfigService,
UserService,
UtilsService,
ClassInitService,
MessengerService,
ClipboardService,
LogsService,
QuickSearchService,
DataTableService,
SplashScreenService,
KeycloakService,
KEYCLOAK_HTTP_PROVIDER,
provide: PERFECT_SCROLLBAR_CONFIG,
useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
,
provide: APP_INITIALIZER,
useFactory: initializer,
multi: true,
deps: [KeycloakService]
,
// template services
SubheaderService,
HeaderService,
MenuHorizontalService,
MenuAsideService,
provide: HAMMER_GESTURE_CONFIG,
useClass: GestureConfig
],
bootstrap: [AppComponent]
)
export class AppModule
javascript angular single-sign-on keycloak
Did you implementAPP_INITIALIZER
?
– User3250
Nov 13 '18 at 13:04
Yes i did implement it.
– Massimo De Sabbata
Nov 13 '18 at 15:01
Could you addappModule.ts
in the question?
– User3250
Nov 13 '18 at 15:52
Here u go, thanks!
– Massimo De Sabbata
Nov 15 '18 at 12:32
add a comment |
So i'm trying to set up a sso system with keycloak on my angular app.
I have downloaded the keycloak library keycloak-angular@4.0.2, setted up a keycloak server at localhost:8080/auth, added the keycloak.json on the root of the app, that keycloak made for me:
"realm": "my-app",
"auth-server-url": "http://localhost:8080/auth",
"ssl-required": "external",
"resource": "my-app",
"public-client": true,
"confidential-port": 0
Also I added the keycloak initi function in the main.ts:
import enableProdMode from '@angular/core';
//....some other import....
import KeycloakService from 'keycloak-angular';
var injector = ReflectiveInjector.resolveAndCreate([KeycloakService]);
var keycloak = injector.get(KeycloakService)
if (environment.production)
enableProdMode();
keycloak.init()
.then(() => platformBrowserDynamic().bootstrapModule(AppModule))
.catch(e =>
console.error(e);
);
Now, if i try to make a registration page, someting like this:
export class registration implements OnInit
constructor(keycloak:KeycloakService)
keycloak.register();
ngOnInit()
it works and sends me to a registration page and if i create an account it apears in the keycloak server.
BUT... even if i am not logged in with any account it lets me access any page, also, if i try :
keycloak.isLoggedIn().then(() => console.log("logged"), ()=>console.log("Not logged"));
The result is "logged", but if i try:
keycloak.loadUserProfile();
Then it says
The user profile was not loaded as the user is not logged in.
I can't understand how it works, am i missing someting?
So my question is:
-How do i prevent pages to show if i am not logged in?
-how do a make a user log and stay logged and angular to recognize who is logged and hwo is not.
Sorry if the question is stupid or the text doesn't matck this site best practices, i'm new around here.
thank you all!
UPDATE:
As asked i'm adding app.module.ts
import BrowserModule, HAMMER_GESTURE_CONFIG from '@angular/platform-browser';
import NgModule, APP_INITIALIZER from '@angular/core';
import TranslateModule from '@ngx-translate/core';
import HttpClientModule from '@angular/common/http';
import KeycloakService, KeycloakAngularModule from 'keycloak-angular';
import initializer from './utils/app-init';
import AppComponent from './app.component';
import AppRoutingModule from './app-routing.module';
import AuthenticationModule from './core/auth/authentication.module';
import NgxPermissionsModule from 'ngx-permissions';
import LayoutModule from './content/layout/layout.module';
import PartialsModule from './content/partials/partials.module';
import CoreModule from './core/core.module';
import AclService from './core/services/acl.service';
import LayoutConfigService from './core/services/layout-config.service';
import MenuConfigService from './core/services/menu-config.service';
import PageConfigService from './core/services/page-config.service';
import UserService from './core/services/user.service';
import UtilsService from './core/services/utils.service';
import ClassInitService from './core/services/class-init.service';
import NgbModule from '@ng-bootstrap/ng-bootstrap';
import BrowserAnimationsModule from '@angular/platform-browser/animations';
import GestureConfig, MatProgressSpinnerModule from '@angular/material';
import OverlayModule from '@angular/cdk/overlay';
import MessengerService from './core/services/messenger.service';
import ClipboardService from './core/services/clipboard.sevice';
import PERFECT_SCROLLBAR_CONFIG, PerfectScrollbarConfigInterface from 'ngx-perfect-scrollbar';
import LayoutConfigStorageService from './core/services/layout-config-storage.service';
import LogsService from './core/services/logs.service';
import QuickSearchService from './core/services/quick-search.service';
import SubheaderService from './core/services/layout/subheader.service';
import HeaderService from './core/services/layout/header.service';
import MenuHorizontalService from './core/services/layout/menu-horizontal.service';
import MenuAsideService from './core/services/layout/menu-aside.service';
import LayoutRefService from './core/services/layout/layout-ref.service';
import SplashScreenService from './core/services/splash-screen.service';
import DataTableService from './core/services/datatable.service';
import 'hammerjs';
import AppAuthGuardComponent from './utils/keycloak/app-auth-guard/app-auth-guard.component';
import KEYCLOAK_HTTP_PROVIDER from './utils/keycloak/keycloak.http';
const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface =
// suppressScrollX: true
;
@NgModule(
declarations: [AppComponent, AppAuthGuardComponent],
imports: [
BrowserAnimationsModule,
BrowserModule,
AppRoutingModule,
HttpClientModule,
LayoutModule,
PartialsModule,
CoreModule,
OverlayModule,
AuthenticationModule,
NgxPermissionsModule.forRoot(),
NgbModule.forRoot(),
TranslateModule.forRoot(),
MatProgressSpinnerModule,
KeycloakAngularModule,
],
providers: [
AclService,
LayoutConfigService,
LayoutConfigStorageService,
LayoutRefService,
MenuConfigService,
PageConfigService,
UserService,
UtilsService,
ClassInitService,
MessengerService,
ClipboardService,
LogsService,
QuickSearchService,
DataTableService,
SplashScreenService,
KeycloakService,
KEYCLOAK_HTTP_PROVIDER,
provide: PERFECT_SCROLLBAR_CONFIG,
useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
,
provide: APP_INITIALIZER,
useFactory: initializer,
multi: true,
deps: [KeycloakService]
,
// template services
SubheaderService,
HeaderService,
MenuHorizontalService,
MenuAsideService,
provide: HAMMER_GESTURE_CONFIG,
useClass: GestureConfig
],
bootstrap: [AppComponent]
)
export class AppModule
javascript angular single-sign-on keycloak
So i'm trying to set up a sso system with keycloak on my angular app.
I have downloaded the keycloak library keycloak-angular@4.0.2, setted up a keycloak server at localhost:8080/auth, added the keycloak.json on the root of the app, that keycloak made for me:
"realm": "my-app",
"auth-server-url": "http://localhost:8080/auth",
"ssl-required": "external",
"resource": "my-app",
"public-client": true,
"confidential-port": 0
Also I added the keycloak initi function in the main.ts:
import enableProdMode from '@angular/core';
//....some other import....
import KeycloakService from 'keycloak-angular';
var injector = ReflectiveInjector.resolveAndCreate([KeycloakService]);
var keycloak = injector.get(KeycloakService)
if (environment.production)
enableProdMode();
keycloak.init()
.then(() => platformBrowserDynamic().bootstrapModule(AppModule))
.catch(e =>
console.error(e);
);
Now, if i try to make a registration page, someting like this:
export class registration implements OnInit
constructor(keycloak:KeycloakService)
keycloak.register();
ngOnInit()
it works and sends me to a registration page and if i create an account it apears in the keycloak server.
BUT... even if i am not logged in with any account it lets me access any page, also, if i try :
keycloak.isLoggedIn().then(() => console.log("logged"), ()=>console.log("Not logged"));
The result is "logged", but if i try:
keycloak.loadUserProfile();
Then it says
The user profile was not loaded as the user is not logged in.
I can't understand how it works, am i missing someting?
So my question is:
-How do i prevent pages to show if i am not logged in?
-how do a make a user log and stay logged and angular to recognize who is logged and hwo is not.
Sorry if the question is stupid or the text doesn't matck this site best practices, i'm new around here.
thank you all!
UPDATE:
As asked i'm adding app.module.ts
import BrowserModule, HAMMER_GESTURE_CONFIG from '@angular/platform-browser';
import NgModule, APP_INITIALIZER from '@angular/core';
import TranslateModule from '@ngx-translate/core';
import HttpClientModule from '@angular/common/http';
import KeycloakService, KeycloakAngularModule from 'keycloak-angular';
import initializer from './utils/app-init';
import AppComponent from './app.component';
import AppRoutingModule from './app-routing.module';
import AuthenticationModule from './core/auth/authentication.module';
import NgxPermissionsModule from 'ngx-permissions';
import LayoutModule from './content/layout/layout.module';
import PartialsModule from './content/partials/partials.module';
import CoreModule from './core/core.module';
import AclService from './core/services/acl.service';
import LayoutConfigService from './core/services/layout-config.service';
import MenuConfigService from './core/services/menu-config.service';
import PageConfigService from './core/services/page-config.service';
import UserService from './core/services/user.service';
import UtilsService from './core/services/utils.service';
import ClassInitService from './core/services/class-init.service';
import NgbModule from '@ng-bootstrap/ng-bootstrap';
import BrowserAnimationsModule from '@angular/platform-browser/animations';
import GestureConfig, MatProgressSpinnerModule from '@angular/material';
import OverlayModule from '@angular/cdk/overlay';
import MessengerService from './core/services/messenger.service';
import ClipboardService from './core/services/clipboard.sevice';
import PERFECT_SCROLLBAR_CONFIG, PerfectScrollbarConfigInterface from 'ngx-perfect-scrollbar';
import LayoutConfigStorageService from './core/services/layout-config-storage.service';
import LogsService from './core/services/logs.service';
import QuickSearchService from './core/services/quick-search.service';
import SubheaderService from './core/services/layout/subheader.service';
import HeaderService from './core/services/layout/header.service';
import MenuHorizontalService from './core/services/layout/menu-horizontal.service';
import MenuAsideService from './core/services/layout/menu-aside.service';
import LayoutRefService from './core/services/layout/layout-ref.service';
import SplashScreenService from './core/services/splash-screen.service';
import DataTableService from './core/services/datatable.service';
import 'hammerjs';
import AppAuthGuardComponent from './utils/keycloak/app-auth-guard/app-auth-guard.component';
import KEYCLOAK_HTTP_PROVIDER from './utils/keycloak/keycloak.http';
const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface =
// suppressScrollX: true
;
@NgModule(
declarations: [AppComponent, AppAuthGuardComponent],
imports: [
BrowserAnimationsModule,
BrowserModule,
AppRoutingModule,
HttpClientModule,
LayoutModule,
PartialsModule,
CoreModule,
OverlayModule,
AuthenticationModule,
NgxPermissionsModule.forRoot(),
NgbModule.forRoot(),
TranslateModule.forRoot(),
MatProgressSpinnerModule,
KeycloakAngularModule,
],
providers: [
AclService,
LayoutConfigService,
LayoutConfigStorageService,
LayoutRefService,
MenuConfigService,
PageConfigService,
UserService,
UtilsService,
ClassInitService,
MessengerService,
ClipboardService,
LogsService,
QuickSearchService,
DataTableService,
SplashScreenService,
KeycloakService,
KEYCLOAK_HTTP_PROVIDER,
provide: PERFECT_SCROLLBAR_CONFIG,
useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
,
provide: APP_INITIALIZER,
useFactory: initializer,
multi: true,
deps: [KeycloakService]
,
// template services
SubheaderService,
HeaderService,
MenuHorizontalService,
MenuAsideService,
provide: HAMMER_GESTURE_CONFIG,
useClass: GestureConfig
],
bootstrap: [AppComponent]
)
export class AppModule
javascript angular single-sign-on keycloak
javascript angular single-sign-on keycloak
edited Nov 15 '18 at 12:31
asked Nov 12 '18 at 15:16
Massimo De Sabbata
112
112
Did you implementAPP_INITIALIZER
?
– User3250
Nov 13 '18 at 13:04
Yes i did implement it.
– Massimo De Sabbata
Nov 13 '18 at 15:01
Could you addappModule.ts
in the question?
– User3250
Nov 13 '18 at 15:52
Here u go, thanks!
– Massimo De Sabbata
Nov 15 '18 at 12:32
add a comment |
Did you implementAPP_INITIALIZER
?
– User3250
Nov 13 '18 at 13:04
Yes i did implement it.
– Massimo De Sabbata
Nov 13 '18 at 15:01
Could you addappModule.ts
in the question?
– User3250
Nov 13 '18 at 15:52
Here u go, thanks!
– Massimo De Sabbata
Nov 15 '18 at 12:32
Did you implement
APP_INITIALIZER
?– User3250
Nov 13 '18 at 13:04
Did you implement
APP_INITIALIZER
?– User3250
Nov 13 '18 at 13:04
Yes i did implement it.
– Massimo De Sabbata
Nov 13 '18 at 15:01
Yes i did implement it.
– Massimo De Sabbata
Nov 13 '18 at 15:01
Could you add
appModule.ts
in the question?– User3250
Nov 13 '18 at 15:52
Could you add
appModule.ts
in the question?– User3250
Nov 13 '18 at 15:52
Here u go, thanks!
– Massimo De Sabbata
Nov 15 '18 at 12:32
Here u go, thanks!
– Massimo De Sabbata
Nov 15 '18 at 12:32
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265092%2fwhy-angular-is-not-recognizing-if-a-user-is-logged-in-with-keycloak%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265092%2fwhy-angular-is-not-recognizing-if-a-user-is-logged-in-with-keycloak%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you implement
APP_INITIALIZER
?– User3250
Nov 13 '18 at 13:04
Yes i did implement it.
– Massimo De Sabbata
Nov 13 '18 at 15:01
Could you add
appModule.ts
in the question?– User3250
Nov 13 '18 at 15:52
Here u go, thanks!
– Massimo De Sabbata
Nov 15 '18 at 12:32