React, Vue or Angular, frontend only
Follow this guide if your app is only a React, Vue or Angular frontend, with no backend of its own. At the end your users sign in with Block-Auth and your page shows who they are.
What you'll build
You need one piece: the Block-Auth widget (@block-auth.io/react, /vue or /angular) in your frontend, with no backend routes.
- The user presses the sign-in button and the login opens on the Block-Auth page (
auth.block-auth.io), in a popup, or in the same tab if the browser blocks popups. - When they finish, the widget checks the result itself (PKCE, without any secret) and shows their profile menu.
- The session lives in that browser tab: it survives reloads, the widget renews it on its own and the profile menu closes it.
When to use it
The widget signs the user in in the browser: your page knows their address and roles, but no server has a session it can trust. Use it to show who is signed in and adapt your UI, not to protect data.
If your app has an API, private data or anything a server must authorize, follow React, Vue or Angular (+ backend) instead: there your backend redeems the login with its API Secret and keeps its own session.
Prepare your app
- In the Dashboard, create your application following the Integration Quickstart. As the domain, enter the host where your frontend runs (for example
your-app.com). - Pick the keys based on where your app is going to run. Each environment has its own in Applications » Integration details, and they don't mix. You only need the API Key: without a backend, your app never uses the API Secret.
| Where your app runs | Which keys to use | Where the login works |
|---|---|---|
Your computer (localhost) | The Development ones. They work right away. | Only on localhost, on any port |
| Your live server | The Production ones. They work once you validate your domain. | Only on your validated domain, over https |
- Fill in your data once in the SDK Quickstart, with Frontend only as the type: from then on, each step gives you the files and code already adapted to your app.

