maxmantz/redux-oidc

endsession trigger authorize

attiqeurrehman opened this issue · 4 comments

Hi,

I am facing an issue similar to this where signoutRedirect is calling the /authorize endpoint instead of the /endsession one. It seems like an event is fired by the OidcProvider that triggers the login before the logout finish.

Following is my config:

const userManagerConfig = {
  client_id: 'web.dev',
  client_secret: 'secret',
  redirect_uri: `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}/callback`,
  response_type: 'id_token token',
  scope: 'openid email profile role',
  authority: 'http://localhost:8080',
  silent_redirect_uri: `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}/silent_renew.html`,
  automaticSilentRenew: true,
  filterProtocolClaims: true,
  loadUserInfo: true
};

Here's the screenshot of the calls:

cancells

Thanks,
Attiqe

I figured out the problem was on Login page it was calling userManager.signinRedirect() on componentDidMount so I changed the code with the following:

componentDidMount() {
    const {
      user,
      isLoadingUser
    } = this.props;

    if (!user && isLoadingUser) {
      userManager.signinRedirect();
    }
  }

I faced this issue because our requirement was to redirect to the login screen after logging out and if you have different scenario where you are going to the sigin on button click and then you might not face this issue.

I figured out the problem was on Login page it was calling userManager.signinRedirect() on componentDidMount so I changed the code with the following:

componentDidMount() {
    const {
      user,
      isLoadingUser
    } = this.props;

    if (!user && isLoadingUser) {
      userManager.signinRedirect();
    }
  }

I faced this issue because our requirement was to redirect to the login screen after logging out and if you have different scenario where you are going to the sigin on button click and then you might not face this issue.

I'm facing the same issue, and I believe for the same reason as yours.
What are you passing to your component to populate "isLoadingUser"?

Thanks
Damien

@damien7792 sorry for late reply. Following is the code for isLoadingUser:

function mapStateToProps(state) {
  return {
    user: state.oidc.user,
    isLoadingUser: state.oidc.isLoadingUser
  };
}

@damien7792 sorry for late reply. Following is the code for isLoadingUser:

function mapStateToProps(state) {
  return {
    user: state.oidc.user,
    isLoadingUser: state.oidc.isLoadingUser
  };
}

Thank you, it solved my issue!