mongodb-labs / full-stack-fastapi-mongodb

Full stack, modern web application generator. Using FastAPI, MongoDB as database, Docker, automatic HTTPS and more.
MIT License
441 stars 76 forks source link

Validation email and Magic Link errors in generated app #52

Closed scattered-development closed 19 hours ago

scattered-development commented 1 month ago

details below - I am assuming that these are intended to work out the box, is that correct?

Two similar issues that might be better separate but documenting as one for now in case the root is the same

I can look to fix during the week any pointers appreciated.

Validation Email

validation doesn't work, get error in browser and a 404 for the request in the backend logs

I tried logging in as two other users (one admin one normal) and noted that the email in the is always the same and that of the first super user.

image

Validation error
Please check your email and try again.
172.21.0.7:33442 - "POST /api/v1/login/oauth HTTP/1.1" 200
2024-07-21 19:27:54 INFO       172.21.0.7:33442 - "OPTIONS /api/v1/users/ HTTP/1.1" 200
2024-07-21 19:27:54 INFO       172.21.0.7:33442 - "GET /api/v1/users/ HTTP/1.1" 200
2024-07-21 19:28:02 INFO       172.21.0.7:38152 - "OPTIONS /api/v1/users/send-validation-email HTTP/1.1" 200
2024-07-21 19:28:02 INFO       172.21.0.7:38152 - "POST /api/v1/users/send-validation-email HTTP/1.1" 404

MAGIC LINK

It seems that the tokens are not present client side

The magic link email is sent but pasting into browser returns a bad request due to missing port adding port :3000 takes me to page magic page where I get a front end error and a 403 in the backend

EDIT - I forgot I have edited the email client and need to check that as the cause

Login error
Ensure you're using the same browser and that the token hasn't expired

"POST /api/v1/login/claim HTTP/1.1" 403

scattered-development commented 1 month ago

Fixed

Turns out the error is due to the payload types; the keys are of type string but the Model expects ObjectId. Fixing this sorts out the validation link as well. Again, can create a PR if wanted.

incorrect email in form on screen but guessing this is just incomplete nature of a template - if you want that updating as well let me know

blink1073 commented 1 month ago

Hi @scattered-development, yes, please create a PR!

scattered-development commented 2 weeks ago

PR here sorry for delay https://github.com/mongodb-labs/full-stack-fastapi-mongodb/pull/53

Jibola commented 19 hours ago

PR Merged!