Closed pablogarzon1969 closed 3 years ago
Hmm, interesting. I do the exact same thing in my sample app. You could try cloning it and configure it to work with your IDS?
The logOut(...)
method does nothing too magical, basically it will:
logoutUrl
on the IDSYour IDS will need to effectively end the session and redirect you back to the application. You could try to control the location with the postLogoutRedirectUri
config value.
When you get back, the user should no longer be logged in. If there's an issue, it's likely either in the IDS, or in the way your app handles state? We'd need a full but minimal reproducible scenario (e.g. Stackblitz sample) to be able to reliably help.
@jeroenheijmans I think I'm having the same problem. In my case I configure the library with this code.
const config = authConfig(this.configService.config);
this.oauthService.configure(config);
this.oauthService.logoutUrl = config.logoutUrl;
this.oauthService.setStorage(this.localStorage);
this.oauthService.setupAutomaticSilentRefresh();
this.oauthService.loadDiscoveryDocumentAndTryLogin().then(() => {
if (!this.oauthService.hasValidAccessToken()) {
this.oauthService.initCodeFlow();
}
});
When I then logout, the logoutUrl seems to be cleared.
It seems like this is related to me changing the module configuration from a static object to providing the config as a dynamic value.
Previously it was configured like this:
OAuthModule.forRoot({
resourceServer: {
sendAccessToken: true,
},
})
It was then configured like this:
imports: [
OAuthModule.forRoot(),
],
providers: [
{
provide: OAuthModuleConfig,
useFactory: (configService: ServerConfigService): OAuthModuleConfig => ({
resourceServer: {
allowedUrls: [configService.config.apiBaseUrl],
sendAccessToken: true,
},
}),
deps: [ServerConfigService],
},
]
When I injected everything (OAuthModuleConfig
, AuthConfig
and OAuthStorage
) with providers it started working again. Could it be that only one of the two configuration method is supported simultaneously?
Yeah I never really use the setStorage
and configure
methods. I prefer to use the Angular DI system to inject configuration and storage. Not sure if that plays into this issue...
@jeroenheijmans I don't really have a preference, however I think it would be worth to inspect if the two configuration methods are conflicting. I don't know if it plays into this issue either, but I figured it could be a clue since I had the same symptoms. :)
@jeroenheijmans the project that has the mentioned problem is the following url https://github.com/pablogarzon1969/angular-ws02-IS and this uses the ws02 Identity Server
Also validate a project that had in angular 4 and with the version of the package angular-oauth2-oidc = 3.1.4 and if it works, but after this version it presents the problem with the ws02 Identity Server of not returning to the login page and does not delete WS02 IS session
I am trying to use
this.oauthService.logOut()
but it does not return to the login page, it just removes the access_token and other information from it. The identity that I use on the WS02 Indentity server.Example
oauth2.config.ts
app.component.ts
info.component.ts
Is this an issue or configuration problem?