woonuxt icon indicating copy to clipboard operation
woonuxt copied to clipboard

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

Open j-salins opened this issue 1 year ago • 10 comments

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.

j-salins avatar Aug 27 '23 18:08 j-salins

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

scottyzen avatar Aug 28 '23 20:08 scottyzen

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?

M-GRV avatar Oct 30 '23 15:10 M-GRV

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 avatar Nov 22 '23 16:11 colingell

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 avatar Nov 23 '23 11:11 colingell

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

colingell avatar Nov 23 '23 12:11 colingell

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.

scottyzen avatar Nov 23 '23 19:11 scottyzen

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

bluebird12 avatar Apr 02 '24 07:04 bluebird12

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 avatar May 24 '24 18:05 ShramkoO

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

ShramkoO avatar May 26 '24 12:05 ShramkoO

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

diegomassaroo avatar Jul 29 '24 14:07 diegomassaroo