Integration

Integration Walkthrough

The full path from a blank workspace to a working app where users sign in and every piece of data they save is private to them — explained in plain language, step by step, whether you are building with an AI coding tool or writing the integration yourself.

On this page

  1. Before you start
  2. The mental model, briefly
  3. Step 1 — Create a workspace
  4. Step 2 — Register an application
  5. Step 3 — Understand the redirect URI
  6. Step 4 — Choose how you will build
  7. What actually happens when a user signs in
  8. Working with a user’s private data
  9. Signing out and expired sessions
  10. Common issues
  11. Verify it is working
  12. Where to go next

Before you start

You need one thing: a secureFlows account, which you get by signing in at the top of Workspace Management with a Google account. Everything else — the workspace, the application, the sign-in screen your users see — is created from there. There is nothing to install and nothing to deploy on secureFlows’ side; you are only ever connecting your app to a system that is already running.

You will make two decisions along the way: what to name your workspace, and whether an AI coding tool writes the integration code for you or you write it by hand. Both are covered below, and neither is permanent — you can rename things and change your approach later without losing anything.

The mental model, briefly

Four ideas carry the whole integration. If you want the longer, non-technical version of this, read What is secureFlows? first — here is just enough vocabulary to follow the rest of this page:

1Create a workspace

Sign in at Workspace Management and create a workspace. Pick any name — it is how you will refer to this account when you connect an app later, not something your end users ever see.

At creation you will see two toggles worth understanding before you flip them:

Both are settings you can change later — neither one is a one-way door.

2Register an application

Inside your workspace, register an application for the product you are building. You will set three things:

A workspace can hold more than one application — if you build a second product later, register a second application in the same workspace instead of starting over.

3Understand the redirect URI

After a user signs in, secureFlows has to send their browser back to your app. The redirect URI is the exact address you tell secureFlows it is allowed to send them to — and it is an allowlist for a real reason: without it, a stolen or manipulated login link could redirect a user to an attacker’s site instead of yours.

The default that works for most people

Use your app’s public web address plus /callback — for example https://my-app.com/callback. Add that under Redirect URIs when you register the application, and make sure your app has a page or route at that address (more on what that page needs to do further down).

Building on an AI app builder with a preview sandbox (Lovable, Base44, and similar tools)? The preview host often is not known until you try signing in once. If the default above does not work right away, follow Finding the correct redirect URL — it walks through discovering the exact preview and published URLs step by step.

4Choose how you will build

Both paths end at the same place: a working sign-in screen and private per-user storage. They differ in who writes the code.

Build with an AI coding tool

Tell your AI coding tool (Cursor, Claude Code, Lovable, Base44, and similar) to use secureFlows, and point it at the technical reference it needs:

Use secureFlows for auth and data storage (read https://www.secure-flows.com/ai/secureflows-integration/SKILL.md). Use: workspace = <your workspace>, appId = <your application ID>

That one instruction is usually enough — you do not need to describe the auth flow, the callback route, or the storage API yourself. The tool reads that reference and writes the sign-in screen, the callback handling, and the calls to secureFlows for you. Describe the rest of your app normally.

Write the integration yourself

If you are hand-coding it, you will implement three pieces: a link or button that sends users to hosted login, a /callback route that stores the token secureFlows hands back, and calls to the Session API using that token. The next two sections describe exactly what each piece does, in order.

The complete request-and-response reference (exact HTTP calls, headers, and JSON bodies) is in the Integration Quickstart — this page explains what is happening and why; that one shows the wire format.

What actually happens when a user signs in

Whichever path you chose, this is the sequence underneath it. Knowing it makes the rest of the integration — and any troubleshooting — much easier to reason about:

  1. Your app sends the user to hosted login with your workspace name, your application ID, and your redirect URI. This can be a link, a redirect, or a button — there is no popup and no embedded login form in your app.
  2. secureFlows shows its sign-in screen. The user signs in with an email/password or one of the configured providers. If their browser is already signed in from a previous visit, they see a confirmation prompt (“Continue as <email> to <your app’s display name>?”) rather than being signed in silently — this is why the display name you set in step 2 matters.
  3. The browser lands back on your redirect URI with a session token attached to the address. This is the one and only moment your app receives that token.
  4. Your app stores the token and uses it as proof of who’s signed in for every following request. Nothing about the user’s identity is ever passed in a request body — the token alone is what secureFlows checks.

Your app never sees a password, never stores one, and never talks to an identity provider directly — all of that happens on secureFlows’ side, behind the hosted screen.

Working with a user’s private data

Once your app has a session token, it can read and write that one user’s private storage. Storage is simple on purpose — a flat set of key/value pairs, scoped automatically to the signed-in user. There is no schema to design and no per-user filtering to write; asking for a key always returns only that user’s value for it, because the token itself is what determines whose data you are looking at.

What you want to doCallNotes
Read everything the user has savedGET /api/v1/sessionsReturns a flat object of every key/value pair; an empty session returns {}.
Read one valueGET /api/v1/sessions/get/<key>A key that was never written returns 404 — treat that as “use a default,” not an error.
Save one valuePOST /api/v1/sessions/set/<key>Body is { "value": ... }; the value can be a string, number, boolean, array, or object.
Delete one valueDELETE /api/v1/sessions/delete/<key>Returns true if something was deleted, false if the key was already gone.
Show the signed-in user’s emailGET /api/v1/sessions/identityUse this for display purposes instead of trying to read the token yourself.

Every one of these calls needs the session token from the callback step, sent as Authorization: Bearer <token>. A request without it is not a bug on secureFlows’ side — it is treated the same as a signed-out user.

Signing out and expired sessions

To sign a user out, call POST /api/v1/sessions/revoke with their token, then discard it on your side and send them back to hosted login. Once revoked, that token stops working entirely — any further request with it is rejected.

Separately, a token can simply expire after enough time has passed. This is not the same thing as losing data: the user’s stored information is untouched, and the fix is the same either way — send them back through hosted login. They get a fresh token for the same underlying session, and everything they saved is exactly where they left it.

Common issues

Verify it is working

Before calling the integration done, walk through this once yourself, in a private/incognito window so you are not relying on an already-signed-in session:

  1. Open your app and sign in as a brand-new user through hosted login.
  2. Save something — anything your app writes to storage.
  3. Sign out.
  4. Sign back in as that same user and confirm what you saved is still there.
  5. Sign in as a different user and confirm you do not see the first user’s data.

That last step is the one people skip and the one that matters most — it is the actual proof that per-user isolation is working, not just that sign-in works.

Where to go next

For the exact request and response format of every call on this page, see the Integration Quickstart. For the full technical reference an AI coding tool reads, see SKILL.md. For interactive API docs, see the OpenAPI hub. For the security model behind all of this, see Platform Architecture.