Back

FastAPI JWT Token

  • 0
  • Self Hosted
  • Auth
Harvey
27 Apr, 2024, 22:49

I'm working on a new project using Appwrite as a backend. I have some experience with it, and i use it for some of my personal and hobby projects and for the first time, I'm building something customer facing with Appwrite. I'm building an API first service, using excellent FastAPI library as API for users. I hooked up frontend to Appwrite and on Appwrite side I'm using auth, Database, Storage and functions to manage stored files. API works with files where user uploads a file, and performs operations on it, some are fairly heavy and async with Celery. What I want to achieve is when user registers and creates an account, user would go to account settings and generate an API key (standard JWT) to authenticate each API call to API (upload files, process files, see current usage stats etc), and I can't figure out exactly how to do that. I tried create_token function from SDK but it's not working as expected. I can't seem to find any docs around this specific usecase. So to summarize; user creates account -> opens account settings -> generates JWT from Appwrite backend -> JWT doesn't expire (like OpenAI API for example or multitude of other REST API services) -> user uses JWT to authenticate endpoint interactions. Is that doable with Appwrite?

TL;DR
Developer building an API with FastAPI for Appwrite backend needs help generating a JWT for user authentication. They want users to generate a JWT in account settings that doesn't expire, but are having trouble with the SDK. They are looking for a solution to authenticate API calls using JWT.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more