Skip to main content

Custom backend

You can use a custom backend to handle requests from your Mini. This page describes how to connect to your backend and verify requests.


You can verify a request originates from a user in the Shop app by attaching a temporary token to the request inside the Mini and exchanging it for a user identifier on your backend.

  1. Generate a temporary token using the useGenerateUserToken hook.
  2. Attach the token in the headers of your network request.
  3. Verify the token using the userTokenVerify mutation in the Shop Minis Admin API.

This is useful for identifying the user making the request and for rate limiting requests to your backend.

Setup your Mini

You must run the setup command and include the openid scope in your manifest.json before you can use the useGenerateUserToken hook.

Caching lookups

Ensure you cache the token exchange lookup to avoid unnecessary requests to the Shop Minis Admin API. You can use the tokenExpiresAt field in the response to invalidate the cache when the token expires.


If you need access to the user's publicId, include the openid scope in your manifest.json. publicId will allow you to identify users across Minis.


This reference implementation shows how to securely authenticate Shop Mini users and process their requests using Supabase Edge Functions. This guide can be extrapolated to other backend services.


Was this page helpful?