How to logout from Linkedin after logging in?
muzamilkp opened this issue · 2 comments
muzamilkp commented
How to logout from Linkedin after logging in?
nvh95 commented
@muzamilkp Since we are implementing an oauth2 flow, we do not import any javascript SDK from linkedin, so it can't logout linkedin.com by itself.
It's likely that you are using this library to retrieve the Authorization code
, then using it to validate in the backend, then create an account for the user, then create and send user an token. In that case, to logout, we might need to clear that token from client's browser and invalidate that token.
theone3nu commented
I was able to manage logout from linkedin by using below code. Hope this will be helpful for those who wants to allow multiple linked in accounts in their app.
const logoutLinkedin = (url) => {
// Invisible window popup
const win = window.open(
url,
'_blank',
'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10000, top=10000, width=10, height=10, visible=none'
);
setTimeout(() => {
win.close();
}, 3000);
};
logoutLinkedin('https://linkedin.com/m/logout'); //This will logs out user from linked in profile