scottyzen / woonuxt

Static e-commerce powered by WooCommerce & Nuxt
https://woonuxt.com
GNU General Public License v3.0
628 stars 163 forks source link

Log In trows error "Password was correct, but there was an error logging in." #56

Open j-salins opened 1 year ago

j-salins commented 1 year ago

refreshCart() method returns results from graphql query GqlGetCart where customer object fields are empty and viewer object is null.

Could this be because of incorrect graphql plugin configuration or something else?

When registering new user from nuxt app, it saves data on backend, but throws same error in nuxt.

scottyzen commented 1 year ago

Hi @j-salins. Can you send me your front-end URL and I'll have a look to see what's going on? It sounds like it could be a cors issue. Check and make sure the WPGraphQL CORS plugin is set up correctly

M-GRV commented 10 months ago

refreshCart() method returns results from graphql query GqlGetCart where customer object fields are empty and viewer object is null.

Could this be because of incorrect graphql plugin configuration or something else?

When registering new user from nuxt app, it saves data on backend, but throws same error in nuxt.

Are you still seeing this concern or can the issue be closed?

colingell commented 9 months ago

I've come across this but if I set

const viewer = useState('viewer', ()=> 'myusername');

in useAuth.ts

It allows the login, to me it seems like the const updateViewer doesn't get called to update viewer.value with the payload.

I'm not too sure if any of this helps??

colingell commented 9 months ago

adding viewer.value = {databaseId: 0, id: '', username: credentials.username}; in the const loginUser seems to be a workaround, but I still need 'viewer' to update properly??

colingell commented 9 months ago

seems I can't disable cors for use in localhost :/ https://www.reddit.com/r/Nuxt/comments/10ypi1y/headless_wp_authentication_with_nuxt_3/

'WP GraphQL CORS extension' comes with loginWithCookies

scottyzen commented 9 months ago

Hey guys.

If ye PM me the WPGraphQL endpoint that ye are having issue's with I can take a look. Sound's like the backend might me missing a few settings.

bluebird12 commented 5 months ago

I have also problems logging in, sometimes it works, most of the time it doesn't.

ShramkoO commented 3 months ago

Hello! @scottyzen . It looks like the nuxt app, the client somehow doesn't attach cookies that are asked to set by server.

You can try it here https://graceful-gaufre-d45d6e.netlify.app/

Screenshot 2024-05-24 at 21 11 38 Screenshot 2024-05-24 at 21 12 42 Screenshot 2024-05-24 at 21 12 59
ShramkoO commented 3 months ago

Got it working after:

  1. Used https
  2. Used same domain name for wordpress site and for nuxt app. So nuxt app is on mydomain.com and wordpress is on wp.mydomain.com
  3. Set "Samesite cookie mode" to LAX on the WPGraphQL CORS settings page

Now cookies were sent well and logged in successfully and viever is not empty in the response from the wp

diegomassaroo commented 1 month ago

Is there a way to test it locally without changing the 'SameSite cookie mode' to LAX?