nhost / hasura-backend-plus

🔑Auth and 📦Storage for Hasura. The quickest way to get Auth and Storage working for your next app based on Hasura.
https://nhost.github.io/hasura-backend-plus/
MIT License
1.17k stars 187 forks source link

auth.login issue with nuxt module #610

Open rmaxxx opened 3 years ago

rmaxxx commented 3 years ago

Hello,

Trying nuxt module with hbp (standalone from source), and i get an error when calling auth.login :

await this.$nhost.auth.login({
  email: this.login,
  password: this.password
});

I get a validation error:

{data: "Error validating request body. \"value\" does not match any of the allowed types.", status: 400, statusText: "", headers: {…}, config: {…}, …}

If i check in dev tools, "cookie": false is added to the request payload.

Tested the endpoint with postman and it works fine, but if i add "cookie": false to the payload, i get the same body validation error...

Thanks.

rmaxxx commented 3 years ago

Fixed sorry!

elitan commented 3 years ago

Fixed sorry!

What was the fix?

It might be helpful for other users with the same problem to learn what was wrong and how you fixed it.

plmercereau commented 3 years ago

Same problem here. I think nhost-js-sdk is out of sync with the latest HBP version, as it sends this cookie: false/true while payload validation does not expect it (see @utils/validation). Reopenning

migsar commented 3 years ago

I came here looking for a different question (Why with Insomnia HTTP client I received cookies but with nhost-js-sdk I didn't?) but this point me in the right direction... the library has the default for cookies set to false.

I think the problem is not being clear on docs about which the latest version is, don't get me wrong, I know it is hard... I am using v2.5.2 because @elitan suggested me to do that way in a previous issue I opened. Here: https://github.com/nhost/hasura-backend-plus/commit/3b32d4bb33fabb87055f5fac3bb715e6d11d03e2 we can see cookie param was introduced on v2.2.0 and it is still present on the latest release.

Still it doesn't seem to be present on master, which is v2.3.0 according to package.json.

migsar commented 3 years ago

Related https://github.com/nhost/nhost-js-sdk/issues/49

elitan commented 3 years ago

I came here looking for a different question (Why with Insomnia HTTP client I received cookies but with nhost-js-sdk I didn't?) but this point me in the right direction... the library has the default for cookies set to false.

I think the problem is not being clear on docs about which the latest version is, don't get me wrong, I know it is hard... I am using v2.5.2 because @elitan suggested me to do that way in a previous issue I opened. Here: 3b32d4b we can see cookie param was introduced on v2.2.0 and it is still present on the latest release.

Still it doesn't seem to be present on master, which is v2.3.0 according to package.json.

Versions and master have been a bit out of sync. It should be fixed in the coming days. I'll update this thread once we've released a new version of HBP with the latest changes.

Generally, these issues seem related to nhost-js-sdk. I'll come back to this later.