Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No possibility to modify HTTP calls in chat bubble before they are sent to server #227

Open
CasperJ opened this issue Aug 20, 2024 · 0 comments

Comments

@CasperJ
Copy link

CasperJ commented Aug 20, 2024

Problem

When you embed the Chat bubble into a site that is protected by a reverse proxy or API gateway, then all calls must be authenticated.
Currently, Flowise doesn't support injecting Auth headers or modifying CORS settings before sending the request to the API server.

Solution

#226 fixes this by introducing an OnRequest hook in which the request can be modified.

Example

        FlowiseAiChatBot.init({
            chatflowid: "...",
            apiHost: "/api/ai/",
            chatflowConfig: {
                // topK: 2
            },
            onRequest: async (request) => {
                const cred = await myIdentityApi.getCredentials();
                const headers = new Headers(request.headers);
                headers.append("Authorization", `Bearer ${cred.token}`);
                request.headers = headers;
            },
           ...
        });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant