Cannot log in
I followed the tutorial to set up authentication. The registration works, I can see the user in the database with the hashed password. I'm using username + password authentication.
On the login page I'd enter the username and password but when I click login I'm not redirected to my landing page.
I get a 200 from
http://localhost:3001/auth/local/login
and my JWT token is there, but then I get a 401 from http://localhost:3001/auth/me
:sadboi:8 Replies
Update: I'm looking at the auto-generated
createAuthRequiredPage
component, and while the login return isSuccess=true
somehow my user=null
π¦
Update: Ok, turns out the auth cannot handle if my user type is not named User
. I'm building a game so I wanted to call my users Player
.How did your wasp file look like when you used Player? You can configure the auth entity to be any entity π
My wasp file was like it's shown in my original post. I've defined
userEntity: Player
but perhaps I was missing some other configuration?Wohooo @Kajatin, you just became a Waspeteer level 1!
hmm you can also explicitly define where user is sent upon successful auth, but by default it goes to "/" : https://wasp-lang.dev/docs/language/features#onauthsucceededredirectto-string-optional
is your repo public, can you share it with us?
It's public and I see you've already found it. It's not a problem that I had to call it
User
if you think it might be a bug I can create a minimal example after the hackathon is over and come back to you.
Right now I'm just focused on the project for the hackathon πThanks for reporting this @Kajatin , I opened an issue for it on GH! https://github.com/wasp-lang/wasp/issues/1204