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

Cookies deleted but the tokens are still in Local Storage #1384

Open
deepdesai003 opened this issue May 27, 2021 · 4 comments
Open

Cookies deleted but the tokens are still in Local Storage #1384

deepdesai003 opened this issue May 27, 2021 · 4 comments
Labels

Comments

@deepdesai003
Copy link

deepdesai003 commented May 27, 2021

Hello, this is a question.

I am using oidc client for authenticating a JS client with identity server.
I have a callback html and this callback html is throwing an error every time the app is mounted and callback.html is called.
ErrorResponse: login_required

This happens only when a cookies is deleted, and the local storage still contains a an unexpired token.
My token is not expired, my code handles log out for token expiry.

What is the best practice, should I just suppress error?
Where can I see the logs, to pinpoint the reason for the message?

Deep

callback.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <script src="dist/oidc-client.min.js"></script>
    <script>
        var config = {
            response_mode: "query"
        }

        new Oidc.UserManager(config).signinRedirectCallback().then(function () {
            window.location = "/#/account-search";

        }).catch(function (e) {
            console.error(e);
        });
    </script>
</body>
</html>
@brockallen
Copy link
Member

It's not clear to me the context in which you get "login_required" (silent login, automatic silent login, query session status?), but what it means is that you made a request to the authorize endpoint, the user does not have a session so they must login, and so the response failed and that error code let you know why it failed.

@deepdesai003
Copy link
Author

Even, I am not able to understand the context. Are there any logs to where I can see a more clear reason?
When a user reloads the app, the callback.html is also reloaded and the script runs on it own.
signinRedirectCallback() throws the error when the tokens are in local storage but cookies are somehow deleted for the site

@brockallen
Copy link
Member

signinRedirectCallback() throws the error when the tokens are in local storage but cookies are somehow deleted for the site

But the error is "login_required"?

@deepdesai003
Copy link
Author

Yes, from the callback.html

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

No branches or pull requests

2 participants