r/FastAPI • • Dec 09 '22

Question Update current logged in user

Hello guys, I am creating an application using FastAPI. I have a problem right now, i want to update the information of the current logged in user. How would i implement that?

1 Upvotes

5 comments sorted by

1

u/bananajaviert Dec 09 '22

Using your current user dependency, you find that user from your database with the information on it. An example would be getting the username from the current user and filtering it from your db and update it.

2

u/Secret_Benefit5988 Dec 09 '22

Yea, thats what im thinking. I passed in my current user to my route. Thank you so much !

2

u/bananajaviert Dec 09 '22

No worries. Goodluxck !

1

u/me-inreddit Dec 09 '22

I have the same issue. I have filtered my db equals to my active user, but t returns nothing.

1

u/me-inreddit Dec 09 '22

I FIXED IT. I passed in current user in my function and database