---
title: "React, Vue or Angular, frontend only: go live"
description: "The checks before publishing your integration without a backend."
url: "/sdk-integration-frontend-go-live/"
language: "en"
guide: "React, Vue, Angular (frontend only)"
step: "Quickstart step 3 of 3, required"
---

# Go live

Your code doesn’t change: only the key and the domain do. Here are just those changes, with your production data.

Every example on this page uses the production values: the production API Key and API Secret and the app’s real domain.

## What changes

### 1. Validate your domain and use the Production key

In the Dashboard, [validate your domain](/integration-quickstart.md#apps-validate-domain). Then copy the **Production** data with **Copy data for the guide** and paste it into [your data](/sdk-integration.md#setup): it fills in the Production row.

### 2. Build with the production apiKey

Your `apiKey` is baked in at build time: build with the production one.

#### Vite (React · Vue) · development

This is your frontend’s `.env`, at the root of your project.

**.env, next to the frontend package.json**

```dotenv
VITE_BLOCKAUTH_API_KEY=your_api_key
```

#### Vite (React · Vue) · production

It’s baked into the build, so it must exist where you build for production. Pick how you build:

**File · .env.production · in your frontend folder**

```dotenv
VITE_BLOCKAUTH_API_KEY=your_api_key
```

**Docker · Dockerfile · right before npm run build**

```dotenv
ARG VITE_BLOCKAUTH_API_KEY
RUN npm run build
```

**Docker · docker-compose.yml · in the service that builds your frontend**

```dotenv
build:
  args:
    VITE_BLOCKAUTH_API_KEY: ${BLOCKAUTH_API_KEY}
```

**CI · Variable of your CI · in the job that runs npm run build**

```dotenv
VITE_BLOCKAUTH_API_KEY=your_api_key
```

#### Next.js (React) · development

This is your frontend’s `.env.local`, at the root of your project.

**.env.local, at the project root**

```dotenv
NEXT_PUBLIC_BLOCKAUTH_API_KEY=your_api_key
```

#### Next.js (React) · production

It’s baked into the build, so it must exist where you build for production. Pick how you build:

**File · .env.production · in your frontend folder**

```dotenv
NEXT_PUBLIC_BLOCKAUTH_API_KEY=your_api_key
```

**Docker · Dockerfile · right before npm run build**

```dotenv
ARG NEXT_PUBLIC_BLOCKAUTH_API_KEY
RUN npm run build
```

**Docker · docker-compose.yml · in the service that builds your frontend**

```dotenv
build:
  args:
    NEXT_PUBLIC_BLOCKAUTH_API_KEY: ${BLOCKAUTH_API_KEY}
```

**CI · Variable of your CI · in the job that runs npm run build**

```dotenv
NEXT_PUBLIC_BLOCKAUTH_API_KEY=your_api_key
```

#### Create React App (React) · development

This is your frontend’s `.env`, at the root of your project.

**.env, at the project root**

```dotenv
REACT_APP_BLOCKAUTH_API_KEY=your_api_key
```

#### Create React App (React) · production

It’s baked into the build, so it must exist where you build for production. Pick how you build:

**File · .env.production · in your frontend folder**

```dotenv
REACT_APP_BLOCKAUTH_API_KEY=your_api_key
```

**Docker · Dockerfile · right before npm run build**

```dotenv
ARG REACT_APP_BLOCKAUTH_API_KEY
RUN npm run build
```

**Docker · docker-compose.yml · in the service that builds your frontend**

```dotenv
build:
  args:
    REACT_APP_BLOCKAUTH_API_KEY: ${BLOCKAUTH_API_KEY}
```

**CI · Variable of your CI · in the job that runs npm run build**

```dotenv
REACT_APP_BLOCKAUTH_API_KEY=your_api_key
```

#### Angular (environment.ts) · development

Angular doesn’t use .env: your apiKey goes in this file. If your project doesn’t have it, create the `src/environments` folder (next to `src/app`, not inside it) and this file in it.

**src/environments/environment.ts**

```typescript
export const environment = {
  blockauthApiKey: 'your_api_key',
}
```

#### Angular (environment.ts) · production

Keep `environment.ts` with the development key and put the production one in `environment.prod.ts`, next to it. Then tell `angular.json` to swap them in the production build (`ng build`, the default configuration), so development keeps working on `localhost`.

**src/environments/environment.prod.ts · new file**

```typescript
export const environment = {
  blockauthApiKey: 'your_api_key',
}
```

**angular.json · inside projects › your-app › architect › build › configurations › production**

```dotenv
"fileReplacements": [
  {
    "replace": "src/environments/environment.ts",
    "with": "src/environments/environment.prod.ts"
  }
]
```

#### apiKey written in the widget config (React · Vue · Angular) · development and production

Your apiKey goes straight into the widget config (next step), no environment file.

In the widget config, read the apiKey from that variable instead of writing `your_api_key`:

- Vite (`src/main.jsx · src/main.ts`): `apiKey: import.meta.env.VITE_BLOCKAUTH_API_KEY,`
- Next.js (`app/layout.tsx`): `apiKey: process.env.NEXT_PUBLIC_BLOCKAUTH_API_KEY,`
- Create React App (`src/index.js`): `apiKey: process.env.REACT_APP_BLOCKAUTH_API_KEY,`
- Angular (`src/app/app.config.ts`): `apiKey: environment.blockauthApiKey,`

> **Placeholders in this code:**
>
> - Replace `your_api_key` with your API Key, or fill in your data in the SDK Quickstart and it is filled in for you.

### 3. Serve your app from your domain, over `https`

The Production key only signs users in on your validated domain, over `https`. Publish your build there; with the [login with a redirect](/sdk-integration-frontend-redirect.md), the root of your domain (`/`) must load your app.

### 4. Allow the widget in your Content Security Policy

If your server sends a `Content-Security-Policy` header (many hostings, proxies and security templates add one), the browser blocks the widget until you allow it. You won't notice in development, because the dev server doesn't send it: it shows up after deploying, with an unstyled button, a broken logo and a failing login. Check with `curl -sI https://your-domain | grep -i content-security-policy`; if it returns nothing, skip this step.

Add these directives to the CSP you already send, keeping yours. If you already have one of them, add only the missing sources: **If you set `wsUrl`** (another Block-Auth server), write its host instead of `wss.block-auth.io` in `connect-src`, over `https` and `wss`.

**Content-Security-Policy · HTTP header your server sends**

```text
connect-src 'self' https://wss.block-auth.io wss://wss.block-auth.io;
img-src 'self' data:;
style-src 'self' 'unsafe-inline';
```

- `connect-src`: the widget talks to `wss.block-auth.io` to sign the user in and to keep the session.
- `img-src`: the Block-Auth logo in the button, embedded as a `data:` image.
- `style-src`: the widget injects its styles in a `<style>` tag. It only allows inline CSS, not JavaScript: `script-src` can stay as strict as you have it.

The login opens on `auth.block-auth.io`, in a popup or in the same tab if the browser blocks popups, so you don't need to allow Google, Microsoft or the wallets. If your site sends `Cross-Origin-Opener-Policy`, use `same-origin-allow-popups`, not `same-origin`: otherwise your page can't receive the result from the popup.

### 5. Try it

Same as in [development](/sdk-integration-frontend-try.md), but on your domain: sign in, reload and sign out. If the button has no styles, a broken logo, or the login says it failed, open the browser console (F12): a `violates the following Content Security Policy directive` message means step 4 is missing.

## Before you publish

Go over this before opening your app to your users:

- Your production app has its own validated domain and key, and the site uses `https`.
- The `apiSecret` isn't anywhere in your app or its build.
- Nothing on a server trusts the address your page knows: if you add an API or private data, move to [React, Vue or Angular (+ backend)](/sdk-integration-spa.md).
- If your server sends a CSP, allow the widget as in [step 4](#production-csp), and if it sends `Cross-Origin-Opener-Policy`, it's `same-origin-allow-popups`.

**With this, the integration is done.** What follows under **More options** is optional: add it when your app needs it.

This is the last required step of the guide. What follows under More options is optional.
