I have integrated my angular application with keycloak identity server, after i login i redirect it to the layout module but it redrects it to the url with the session state like (http://localhost:4200/dashboard?state=ekd0MWVVeTBLLmhudjNfci1QMzFLNmotUUtKRGlCYmhSR3dqUElhV1RYT1Ay&session_state=f96c557f-8120) . but what i want is to redirect to localhost:4200/dashboard, how can i acheive this. is there anything that i missed on my code configration or files ? enter image description here
export const authCodeFlowConfig: AuthConfig = {
issuer: environment.authConfig.issuer,
tokenEndpoint: environment.authConfig.redirectUri,
redirectUri: window.location.origin,
useSilentRefresh: true,
clientId: environment.authConfig.clientId,
responseType: environment.authConfig.responseType,
scope:environment.authConfig.scope,
showDebugInformation: environment.authConfig.showDebugInformation,
};
export function initializeKeycloak(oauthService: OAuthService):Promise<void> {
return new Promise((resolve)=>
{
oauthService.configure(authConfig);
oauthService.setupAutomaticSilentRefresh();
oauthService.loadDiscoveryDocumentAndLogin()
.then(()=>resolve());
});
}
export const appRoutes: Routes = [
{
path: '',
loadChildren: () => import('./modules/layout/layout.module').then((m) => m.LayoutModule),
},
{ path: '**', redirectTo: 'error/404' },
];
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(
appRoutes,
withPreloading(PreloadAllModules)
),
provideHttpClient(),
provideOAuthClient(),
{
provide: APP_INITIALIZER,
useFactory: (oauthService:OAuthService)=>{
return ()=>{
initializeKeycloak(oauthService);
}
},
multi: true,
deps:[
OAuthService
]
},
{
provide: HTTP_INTERCEPTORS,
useClass:AuthInterceptor,
multi: true,
},
importProvidersFrom(OAuthModule.forRoot({
resourceServer: {
allowedUrls: [environment.apiUrl],
sendAccessToken: true
}
}))
],
};
i want it to redirect it to localhost:4200/dashboard without the session state.