Apollo-module: when onLogin after onLogout, cannot get tokens.

Created on 10 Aug 2019  路  8Comments  路  Source: nuxt-community/apollo-module

In my service, After logging out, i cannot login.

The situation is as follows:

await this.$apolloHelpers.onLogin(token)
console.log(11, this.$apolloHelpers.getToken()) // print token

await this.$apolloHelpers.onLogout()
console.log(22, this.$apolloHelpers.getToken()) // print undefined

await this.$apolloHelpers.onLogin(token)
console.log(33, this.$apolloHelpers.getToken()) // expect token, but print undefined

This question is available on Nuxt community (#c222)
question

Most helpful comment

We are also having an issue that must be the same, or related. When we upgraded to "@nuxtjs/apollo": "^4.0.0-rc10", our logout/login functionality broke.
When a user logs out, they are redirected to the login page, but if a log in is attempted, the log in is successful, but the cookies are not set, so the user is not redirect to the root path.

If one refreshes the page, then it all works as expected. Downgrading to rc9 solves the issue.
We had a look at the release notes and the major change is https://github.com/nuxt-community/apollo-module/pull/242, where cookie-universal replaces jsCookie.

Our repo is https://github.com/Human-Connection/Human-Connection
For now, we have just downgraded to rc9, but if anyone has an idea how we can debug what is going on, it would be greatly appreciated.

All 8 comments

This issue as been imported as question since it does not respect apollo-module issue template. Only bug reports and feature requests stays open to reduce maintainers workload.
If your issue is not a question, please mention the repo admin or moderator to change its type and it will be re-opened automatically.
Your question is available at https://cmty.app/nuxt/apollo-module/issues/c222.

Can you setup a codesanbox or a github repo for this?

We are also having an issue that must be the same, or related. When we upgraded to "@nuxtjs/apollo": "^4.0.0-rc10", our logout/login functionality broke.
When a user logs out, they are redirected to the login page, but if a log in is attempted, the log in is successful, but the cookies are not set, so the user is not redirect to the root path.

If one refreshes the page, then it all works as expected. Downgrading to rc9 solves the issue.
We had a look at the release notes and the major change is https://github.com/nuxt-community/apollo-module/pull/242, where cookie-universal replaces jsCookie.

Our repo is https://github.com/Human-Connection/Human-Connection
For now, we have just downgraded to rc9, but if anyone has an idea how we can debug what is going on, it would be greatly appreciated.

fixed on v4.0.0-rc.11

hey @kieusonlam, I tested this locally, and it's fixed our bug!!
Thanks!!

We are also having an issue that must be the same, or related. When we upgraded to "@nuxtjs/apollo": "^4.0.0-rc10", our logout/login functionality broke.
When a user logs out, they are redirected to the login page, but if a log in is attempted, the log in is successful, but the cookies are not set, so the user is not redirect to the root path.

If one refreshes the page, then it all works as expected. Downgrading to rc9 solves the issue.
We had a look at the release notes and the major change is #242, where cookie-universal replaces jsCookie.

Our repo is https://github.com/Human-Connection/Human-Connection
For now, we have just downgraded to rc9, but if anyone has an idea how we can debug what is going on, it would be greatly appreciated.

For me, I've had a similar issue and it was that universal-cookie is storing the cookie for current path not for root, specifying this solved it for me.

Great that you pass this info on for others, the changes made from rc10 to rc11 fixed our issue, though I can't remember what those changes were at this time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gbouteiller picture gbouteiller  路  6Comments

yaki4 picture yaki4  路  9Comments

SuddenlyRust picture SuddenlyRust  路  5Comments

kieusonlam picture kieusonlam  路  9Comments

Teeoo picture Teeoo  路  4Comments