Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout issue #68

Closed
nidrax69 opened this issue Feb 13, 2018 · 6 comments
Closed

Logout issue #68

nidrax69 opened this issue Feb 13, 2018 · 6 comments

Comments

@nidrax69
Copy link

nidrax69 commented Feb 13, 2018

Hello,

When i'm on a page like /dashboard displaying information like
{{this.$store.state.auth.user.civlib}}

And if do a this.$auth.logout()
token localstorage is deleted , i'm redirected at the homepage ('/') but i have now an error displaying
Cannot read property 'civlib' of null

My opinion is something have changed from the logout endpoint, and it deletes first the store and after doing the logout. Maybe i'm doing it wrong

I'm coming from v3.4 , but i haven't this error before.
please need some help !

This question is available on Nuxt.js community (#c52)
@fanckush
Copy link

fanckush commented Feb 13, 2018

Hi, logout calls reset which removes both cookies and localstarage but does not reset axios headers, this issue is described here: #57

Not sure if that is the same issue but having token in the header means that you are logged in when making api calls

@breakingrobot
Copy link
Contributor

@nidrax69 Without code reproduction and more info, I would suggest it is a duplicate of #57

I will let this issue open for you to give code reproduction

@nidrax69
Copy link
Author

@breakingrobot Sorry for the delay, i'm running out of time to create code reproduction, because i'm using private API.

I have switch to the previous version for the moment, i will open a new issue if i have the problem later with code reproduction if i have still the problem in the future.

You can close this one

@Skylercrane23
Copy link

I am having a similar issue, I don't think its anything to do with the header. My issue is I am referencing some auth state properties like, loggedIn, username, email, etc. On logout it shows property undefined. I think its something to do with the store being cleared before actually removing the token, or something similar so when the page goes to look for those properties again its undefined since the store doesn't exist.

@sbarfurth
Copy link

This should be reopened. Same issue as @Skylercrane23

@mrleblanc101
Copy link

This issue still exist today, even in Auth-next ! We are using Auth-Next with an OAuth2 scheme (Keycloak).
To logout, Auth-Next do a window.location to the redirect endpoint and has a callback URL to our login page.
But I have some issue with the code bellow, the auth.reset is called before we are redirected to the login page which crash our app since everywhere we use user data we have the Cannot read property 'X' of null.

    logout() {
        if (this.options.endpoints.logout) {
            const opts = {
                client_id: this.options.clientId,
                redirect_uri: this.logoutRedirectURI,
            };
            const url = this.options.endpoints.logout + '?' + qs.stringify(opts);
            window.location.replace(url);
        }
        return this.$auth.reset();
    }
    ```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants