Skip to content

JBorrow/fastapi-jinja-auth

Repository files navigation

FastAPI Auth with Cookies

A couple of examples (one very simple, one using JWT) to do authentication in FastAPI using cookies. Cookies are useful in this context as sometimes you do not have complete control over the form of the HTTP requests being sent to your API server (e.g. in the case of using jinja templates).

If you are interested in learning, I'd start with simpleapp.py and then move on to app.py and its associated auth.py.

The goal of simpleapp.py is to introduce the concept of cookies as auth tokens, and app.py makes this more concrete using JWTs.

There's a third application, githubapp.py that uses the GitHub Apps API to perform the login flow. That's more advanced and essentially uses a remote API to check if you are a member of a given organisation.

References

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published