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.

  1. 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.
  2. When they finish, the widget checks the result itself (PKCE, without any secret) and shows their profile menu.
  3. 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.

Prepare your app

  1. 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).
  2. 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 runsWhich keys to useWhere the login works
Your computer (localhost)The Development ones. They work right away.Only on localhost, on any port
Your live serverThe Production ones. They work once you validate your domain.Only on your validated domain, over https
  1. 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.