Bindings overview
Workflows
The kinde.secureFetch
binding allows you to make POST requests to external APIs where the payload is encrypted with the workflow encryption key you have previously set up in Kinde.
export const workflowSettings = { // ...other settings bindings: {"kinde.secureFetch": {}}};
The Kinde infrastructure library provides type-safe secure fetch requests:
Note: you will also need the url binding enabled for the workflow as this is used under the hood.
import {fetch} from "@kinde-oss/infrastructure";
export default async function Workflow(event) { const {data} = await secureFetch(`https://api.somethingsecret.com/api`, { method: "POST", responseFormat: "json", headers: {"Content-Type": "application/json"} });
console.log(data);}
If you’re not using the infrastructure library, you can call the underlying API directly:
const res = await kinde.secureFetch(`https://ipinfo.io/${event.request.ip}`, { method: "POST", responseFormat: "json", headers: {"Content-Type": "application/json"}});const {json} = res;console.log(json);