Skip to content
  • Workflows
  • Bindings

kinde.fetch

The kinde.fetch binding allows you to make external API calls including to the Kinde Management API.

If you are passing sensitive data we recommend you instead use kinde.secureFetch where the POST body is encrypted.

Available in workflows

Link to this section
export const workflowSettings = {
// ...other settings
bindings: {"kinde.fetch": {}}
};
Link to this section

The Kinde infrastructure library provides a type-safe fetch helper.

Note: you will also need the url binding enabled for the workflow as this is used under the hood.

import {fetch} from "@kinde/infrastructure";
export default async function Workflow(event) {
const {data: ipDetails} = await fetch(
`https://ipinfo.io/${event.request.ip}`,
{
method: "GET",
responseFormat: "json",
headers: {"Content-Type": "application/json"}
}
);
console.log(ipDetails);
}

Using the low-level API

Link to this section

If you’re not using the infrastructure library, you can call the underlying API directly:

const res = await kinde.fetch(`https://ipinfo.io/${event.request.ip}`, {
method: "GET",
responseFormat: "json",
headers: {"Content-Type": "application/json"}
});
const {json} = res;
console.log(json);