
Why My Multi-Tenant Chatbot Needed Two Types of API Keys
I'm building a multi-tenant AI chatbot. Businesses sign up, share their documents and get a chat widget to embed on their website. The widget talks to their knowledge base and only their knowledge base. I covered the WebSocket authentication side of this in a previous post . This one is about the problem that lives on the other end — in the browser. The widget needs to know which tenant it belongs to. That means some form of credential has to exist in the frontend code. As we all know, frontend code is not a friend who can keep secrets. The code is public. Anyone can open DevTools, inspect the network tab, and read the script tag. Whatever key you put there is fully exposed from day one. So the question becomes: how do you authenticate something that can never be secret? Where Do You Even Store This Stuff? Now I need to make a tiny side track here. Before I could even get to the API key problem, I had a session management problem. When an anonymous user opens the chat widget, the backe
Continue reading on Dev.to Python
Opens in a new tab



