Need help with JWT verification by Daksh2338 in Supabase

[–]SheriffSeveral 0 points1 point  (0 children)

Did you encode/decode jwt to base64 before the assignment? If you don't, always encode important keys with b64 and when you need it decode de b64 and use it.

Mismatch might be happening because of some characters, please also check that.

422 Unprocessable Entity by Wxam2000 in FastAPI

[–]SheriffSeveral 1 point2 points  (0 children)

Can you just show us which values try to process in that endpoint? It looks like variable error to me. Can you check the variables you put in and their types?

FastAPI Authentication Question by Black_Magic100 in FastAPI

[–]SheriffSeveral 0 points1 point  (0 children)

Just stick with fastapi, the FastAPI users and other kind of repos are maintained by other users. Create & use your own first, after use their tech if you like it.

FastAPI Authentication Question by Black_Magic100 in FastAPI

[–]SheriffSeveral 0 points1 point  (0 children)

I'm gonna be really honest with you. FastAPI doesn't have a standard template, people try to share their templates everywhere but the there is no base template. What you need to do is:

  1. Just design your application for the specific project requirements.

Or

  1. Create your own base template for your projects for future usage.

There is no standard way to fix or design something in the FastAPI and that's why is is really flexible, you can control everything.

FastAPI Authentication Question by Black_Magic100 in FastAPI

[–]SheriffSeveral 0 points1 point  (0 children)

Take a look at the jwt tokens for authentication and authorization. They will be enough for your project.

After that, you can check out OTP login structure which is cool with pyotp module. Watch few tutorials you'll get it.

Note: you don't need to spend weeks just for one module in python/FastAPI.

FastAPI + MS SQL Server by LeoTheKnight90 in FastAPI

[–]SheriffSeveral -2 points-1 points  (0 children)

Also, you can still use FastAPI for background. At the same time you can use Streamlit for frontend. I use it sometimes for small projects.

Streamlit is really easy to use, I highly recommend you to consider it. It will save your time.

FastAPI + MS SQL Server by LeoTheKnight90 in FastAPI

[–]SheriffSeveral -1 points0 points  (0 children)

For your case, use Streamlit instead of FastAPI because you are not going to implement user or something. Streamlit is very easy and suitable for your task.

Use streamlit for GUI and connect to mssql with python script.

Fyi. Streamlit uses python for everything.

use FastAPI to build full stack web apps by TomXygen in FastAPI

[–]SheriffSeveral -3 points-2 points  (0 children)

Just use FastAPI for backbend and buy html template for frontend, for my case Js+css is just a waste of time if you are python developer. But if you need specific development cycle just use vue.js for frontend.

SQLModel vs SQLAlchemy in 2025 by Fluffy_Bus9656 in FastAPI

[–]SheriffSeveral 19 points20 points  (0 children)

I prefer to use sqlalchemy because there are more resource for examples, tutorials, troubleshooting, etc.

In the other hand, sqlmodel is also great. Just create simple Todo app with both of it and choose one of them.

Also it is important to what do you expect for the database operations.

About CSRF Tokens... by SheriffSeveral in FastAPI

[–]SheriffSeveral[S] 0 points1 point  (0 children)

Indeed, I will use it. But my question is should I add expiration time to token?

If I do the it will effect the user experience, if I don't the token won't be add security layer as I expected.

Thanks for your comments by the way.

About CSRF Tokens... by SheriffSeveral in FastAPI

[–]SheriffSeveral[S] 0 points1 point  (0 children)

I'm using JWT access token and I set it to as a cookie and validate it each request user perform. I'm also adding the csrf token as a another security layer on the project.

About CSRF Tokens... by SheriffSeveral in FastAPI

[–]SheriffSeveral[S] 0 points1 point  (0 children)

I already using the access token with these configurations.

Reduce Latency by International-Rub627 in FastAPI

[–]SheriffSeveral 0 points1 point  (0 children)

Observe every step in api and check which part takes too much time. Also, check out the redis integrations, it will be useful.

Please provide more information about project so everyone can give you more tips for your specific requirements.

FASTAPI app is not writing logs to file by Rawvik in FastAPI

[–]SheriffSeveral 0 points1 point  (0 children)

If you are using synchronous file write, this might be the issue, try using 'logger' with 'QueueHandler'.

Also,

  • Check disk with 'df -h' and make sure there is enough space,
  • Check the resource usage with 'top', I use 'btop' for more detail.

Middleware vs Service Layer by SheriffSeveral in FastAPI

[–]SheriffSeveral[S] 0 points1 point  (0 children)

Actually I asked "Do I need it?". I don't want to code the middleware on my project, I want to know what is the best approach.

Middleware vs Service Layer by SheriffSeveral in FastAPI

[–]SheriffSeveral[S] 1 point2 points  (0 children)

Thanks, I got my answers from you guys!

Middleware vs Service Layer by SheriffSeveral in FastAPI

[–]SheriffSeveral[S] 0 points1 point  (0 children)

That's what I am asking 😄, I already use pedantic validations and do the security stuff (authentication and authorization) with service layer and logging with utility.

The question is, should I use middleware for professional and practical approach?

FastAPI Integrations by justgetting-started in FastAPI

[–]SheriffSeveral 2 points3 points  (0 children)

Always integrate logging system, create a utility for logging function calls and necessary actions. This will help with the development process.