Skip to main content

Smart API routing by Auth0 JWT Contents

· One min read
Josh Twist

Length: 2 minutes

We continue with the example from this post and add smart routing based on claims in the token.

Here's the function handler we create to do the smart routing

import { ZuploContext, ZuploRequest } from "@zuplo/runtime";

export default async function (request: ZuploRequest, context: ZuploContext) {
const data =;
if (data[""] === "this-is-a-claim"){
return fetch("");
else {
return fetch(`${request.params.productId});