Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Help needed on , STS logout then silent renew force to sign in #1388

Open
ebinroy opened this issue Jun 1, 2021 · 0 comments
Open

Help needed on , STS logout then silent renew force to sign in #1388

ebinroy opened this issue Jun 1, 2021 · 0 comments

Comments

@ebinroy
Copy link

ebinroy commented Jun 1, 2021

Hi All,
if STS user has logout then silent renew will be called. In silent renew I will get the query string error="login_required". I tried to the below code but I would like to redirect to the STS login again

function getParameterByName(name, url = window.location.href) {
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

//same as the auth config settings
const stsSettings = {
authority: "https://localhost:5000/",
client_id: "AngularClient",
scope: "openid profile api1",
response_type: "code",

redirect_uri: "http://localhost:4200/signin-callback",
};

var errParam = getParameterByName('error');
console.log("errParam ====> ", errParam);

//STS user logout then remove the User
if (errParam == "login_required"){
//redirect the user to STS for sign-in????????
new Oidc.UserManager(stsSettings).removeUser();
}
else{
new Oidc.UserManager(stsSettings).signinSilentCallback();
}

instead of this code new Oidc.UserManager(stsSettings).removeUser(); I have tried new Oidc.UserManager(stsSettings).signinRedirectCallback(); and new Oidc.UserManager(stsSettings).signoutRedirectCallback(); but nothing is working.

Please help me to achieve this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant