The ProxyMiddleware
is integrated into the TurnkeyClient
through its initializer that accepts a proxy server URL.
TurnkeyClient
with a proxy server URL:
TurnkeyClient
to route all requests through the specified proxy server. The proxy server is then responsible for forwarding these requests to a backend capable of authenticating them using an API private key. After authentication, the proxy server forwards the requests to Turnkey’s backend and relays the response back to the client.
This setup is especially useful for operations like:
X-Turnkey-Request-Url
header to each request, which contains the original request URL. This is used to forward the request to Turnkey’s backend.
Example implementation of a Node.js proxy server:
ProxyMiddleware
is not required, it provides a convenient way to send requests on behalf of unauthenticated users looking to perform operations such as email authentication, wallet import/export, and sub-organization creation.