---
title: "Integration with React, Vue or Angular"
description: "Add Block-Auth to a React, Vue or Angular app: the login widget in your frontend and three routes in your backend."
url: "/sdk-integration-spa/"
language: "en"
guide: "React, Vue, Angular (+ backend)"
step: "Read first"
---

# React, Vue or Angular

Follow this guide if your frontend is a React, Vue or Angular app. At the end your users sign in with Block-Auth and your backend has a verified session for them.

## What you'll build

You need **two pieces**, and this guide covers both:

- **In your frontend:** the Block-Auth widget (`@block-auth.io/react`, `/vue` or `/angular`). It shows the sign-in button and opens the login.
- **In your backend:** three routes that redeem the login code with your API secret. Your backend can be in any language: the examples are in Node.js, PHP, Python and .NET.

The browser never decides who the user is: the widget only passes a one-time code to your backend, and your backend gets the user from Block-Auth.

1. Your frontend → Block-Auth: Login in a popup (PKCE)
2. Block-Auth → Your frontend: One-time code
3. Your frontend → Your backend: `POST /code`
4. Your backend → Block-Auth: `POST /api/auth/token`
5. Block-Auth → Your backend: `{ address, roles }`
6. Your backend → Your frontend: httpOnly session cookie
7. Your frontend → Your backend: `GET /me`
8. Your backend → Your frontend: `{ address, roles }`

## Prepare your app

1. In the Dashboard, create your application following the [Integration Quickstart](/integration-quickstart.md#applications). As the domain, enter the host where your **frontend** runs (for example `your-app.com`).
2. Pick the keys based on where your app is going to run. Each environment has its own in [Applications » Integration details](/integration-quickstart.md#apps-retrieve-keys), and they don't mix:

| Where your app runs         | Which keys to use                                                                                                    | Where you put them                  |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| Your computer (`localhost`) | The **Development** ones. They work right away.                                                                      | The `.env` on your computer         |
| Your live server            | The **Production** ones. They work once you [validate your domain](/integration-quickstart.md#apps-validate-domain). | Your server's environment variables |

3. Fill in your data once in the [SDK Quickstart](/sdk-integration.md#setup): from then on, each guide gives you the files and code already adapted to your app.

Next: [Your frontend](/sdk-integration-spa-frontend.md), the first required step.
