Backend for Frontend (BFF) Auth
Optimize UX and security in web applications with this approach.
Backend for Frontend (BFF) Authorization Sample#
This is the source code from the sample discussed in the Backend for Frontend (BFF) Authorization blog post.
Setup#
This sample uses an OAuth identity provider (tested with Auth0) and Upstash. In order to run the sample you will need to set the following environment variables either in your .env
file if you are running locally or in the Zuplo portal if you are running there.
// Auth0 Environment Variables
// Create a Regular Web Application in Auth0
//https://auth0.com/docs/get-started/auth0-overview/create-applications/regular-web-apps
AUTH0_URL=my-url.us.auth0.com
CLIENT_ID=
CLIENT_SECRET=
// Create an Upstash Redis Database
// https://upstash.com/docs/redis/overall/getstarted
UPSTASH_URL=
UPSTASH_TOKEN=
Running Locally#
Install the local modules and then run local dev
npm install
npm run dev
Discover More Examples
API Linting
See how to use API linting to enforce api consistency and require Zuplo features like policies.
Backend for Frontend (BFF) Auth
Optimize UX and security in web applications with this approach.
Custom Rate Limiting
Invoke the Rate Limit policy programatically and then modify the 429 response.
Custom Modules
How to bundle custom node modules to use in your Zuplo project.