PrimeAcademy / biscayne-syllabus

1 stars 4 forks source link

Problem with login getting a status "400" #20

Closed AsiaOsman06 closed 2 weeks ago

AsiaOsman06 commented 2 weeks ago

Description

Your Real Name

Asia Osman

What do you want to happen? Login What is actually happening? Screenshot 2024-06-17 at 2 12 37 PM

Screenshots / Code Snippets

What did you try? Who did you ask?

debug with lisa

What branch is your code on? Did you git push?

https://github.com/nest8financial/nest8

When was the last time you took a break?

Lunch Break

matthew-black commented 2 weeks ago

Woof. This was a lot!

We found out that the passport.use('local') bit NEEDS to receive username and password in req.body.

So, we modified the user table to have a username column (rather than email), then modified the login Saga:

    const loginObject = {
      username: action.payload.email,
      password: action.payload.password
    }
    // send the action.payload as the body
    // the config includes credentials which
    // allow the server session to recognize the user
    console.log('loginObject in login sagaa', loginObject)
    yield axios.post('/api/user/login', loginObject, config);