Oidc-client-js: UserManager.signoutRedirect() is not redirecting when in subroute.

Created on 20 Sep 2017  路  3Comments  路  Source: IdentityModel/oidc-client-js

I'm building an Angular (4) application and I'm trying to logout via IdentityServer 4.
Here's my UserManager config:

        this.manager = new UserManager({
            authority: "http://localhost:5000",
            client_id: "angular_dev",
            redirect_uri: "http://localhost:4200/login-callback",
            response_type: "id_token token",
            scope: "openid profile email",
            loadUserInfo: true,
            filterProtocolClaims: true
        });

when the user clicks the logout button, I call:

    async logoutAsync(){
        return await this.manager.signoutRedirect();
    }

This works fine when I'm on the main (http://localhost:4200) endpoint, however as soon as I'm on a sub-route (e.g. http://localhost:4200/admin), calling above method will do the following:

  • Logging says: "user removed from storage" and "signOutRedirect sucessfull"
  • No call to endsession endpoint (checked with fiddler)
  • No call to my logout endpoint on identity server
  • Will just reload the page at route "/".

Any idea why this is happening?
Im using "oidc-client": "^1.3.0"

Most helpful comment

Ok, second embarrassing issue in a day.
This was not a oidc-client issue. The button was in an anchor-tag and I forgot to call preventDefault().

Sorry for wasting your time.

All 3 comments

Check network trace. Do you redirect to the token server's end session endpoint at all?

From the working route "/" the redirection works just as expected, from the sub routes e.g. "/admin", no endpoints are hit at all. I just get redirected to "/"

Ok, second embarrassing issue in a day.
This was not a oidc-client issue. The button was in an anchor-tag and I forgot to call preventDefault().

Sorry for wasting your time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StephenRedd picture StephenRedd  路  5Comments

m-andrew-albright picture m-andrew-albright  路  5Comments

arnaldo-infinite picture arnaldo-infinite  路  4Comments

tomeinar picture tomeinar  路  3Comments

ycrumeyrolle picture ycrumeyrolle  路  5Comments