implicit flow logout not working
See original GitHub issueI am using this library to implement the implicit flow. I have successfully implemented the implicit flow and it all works fine. My website is automatically redirecting to the oauth server. After i login successfully i get redirected to my website. I get the access_token and can work with it. It all works fine, but when i click on logout and call oauthService.logOut(); i will not be redirected to the oauth login page. The local storage and its tokens are getting deleted after the logOut() call, but the oauth server still has its informations. So when i click logout, the tokens will disappear but no redirect happens. When i refresh the page, my application automatically gets the valid token from the oauth server again and i stay logged in. I tried to set a logoutUrl in my auth-configs, but it does not matter if there is one in the configs and i also played with false and true paramter of logOut() method. Nothing changes.
This is my login and logout method and this are my auth configs:
loginUrl: 'https://test.azurewebsites.de/oauth/authorize',
logoutUrl: 'https://test.azurewebsites.de/oauth/logout',
redirectUri: window.location.origin+"/index.html",
clientId: 'test',
scope: 'write',
oidc: false,
responseType: 'token'
login(targetUrl?: string): Promise<void> {
let validToken = this.oauthService.hasValidAccessToken();
return this.oauthService.tryLogin()
.then(() => {
if (!validToken) {
this.oauthService.initImplicitFlow(encodeURIComponent(targetUrl || this.router.url));
return Promise.resolve();
} else {
this.isAuthenticatedSubject$.next(validToken);
this.initTokenData(this.oauthService.getAccessToken());
return Promise.resolve();
}
}).then(() => {
this.isDoneLoadingSubject$.next(true);
}).catch(e => {
console.log("ERROR: ", e);
this.isDoneLoadingSubject$.next(true);
return Promise.reject(e);
});
}
logout() {
this.oauthService.logOut(false);
this._tokenData = null;
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top GitHub Comments
Huh, strange. With
this.oauthService.logOut(false)
you should in fact get sent to the log out URL. It should be easy enough to see why it doesn’t work, by setting a break point at the.logOut(...)
line and stepping into that function. At some point it should dolocation.href = '...'
so you should be able to see where that goes wrong.Additionally, this gist might help with debugging too.
Let us know what you find out.
Thanks for your almost instant reply. That was not exactly my case but made me realize which was my error, caused for a wrong config option.
Sorry and thanks!