Business Consent (Third-Party)
What happens between your authorize redirect and the user landing back at your redirect_uri — and what the resulting access token is bound to.
Business Consent (Third-Party)
When a THIRD_PARTY client kicks off an authorization request, the auth server doesn't redirect the user back with a code immediately. It first sends them through a Securely-hosted login + consent screen where the user picks which of their businesses to grant access to.
Second-party clients skip consent entirely. Their client_id and client_secret were generated by the business in the Securely portal and handed to the developer — that handoff is the consent, so no runtime screen is needed. If you're second-party, you can skip this guide.
Why consent exists
A third-party app — one set of keys, used by many businesses — needs to be told which business it may act on behalf of for any given session. A user in Securely may have access to multiple businesses (their own, ones they manage, ones they work for). Consent makes that scope explicit and durable: the access token your app receives is bound to one specific business.
This is also where the user reviews and approves your app the first time. Your client's name and logo appear on the consent screen.
What you implement vs. what Securely handles
You don't build any of this UIThe login and consent screens are hosted entirely by Securely. Your app's job is just to (1) redirect to
/oauth/authorize, and (2) handle the redirect back to yourredirect_uri. Everything in between — login, business picker, approve/deny — is Securely's.
The flow from your app's perspective
Your app Securely User
│ │ │
│ 1. redirect user to │ │
│ /oauth/authorize │ │
│ ───────────────────────►│ │
│ │ 2. login + consent UI │
│ │ ◄──────────────────────►│
│ │ │
│ 3. user redirected to │ │
│ your.app/callback?code=... (or ?error=...) │
│ ◄─────────────────────────────────────────────── │
From your app's perspective there are only two events: you send the user out, and the user comes back. Between those two events, the user logs in, sees the consent screen, and picks a business — all on Securely's domain.
What the user sees
On the consent screen the user sees:
- Your client's name and logo (registered on your client).
- A list of the businesses they have access to.
- Approve / Deny buttons.
They pick one business and choose Approve or Deny.
Coming back to your app
On approve
The user is redirected to your registered redirect_uri with a fresh authorization code:
https://your.app/callback?code=AUTH_CODE&state=2c1c5f8a
Exchange that code at /oauth/token to receive an access token. The access token is bound to the business the user picked.
On deny
The user is redirected to your redirect_uri with an error parameter instead of a code:
https://your.app/callback?error=access_denied&state=2c1c5f8a
Handle this in your callback — typically by showing a friendly "looks like you didn't connect — try again?" page. There's no code to exchange.
What the access token tells you
After the code exchange, the access token contains a business_id claim with the business the user chose. Every API call you make is scoped to that business — the resource API enforces it.
Decoding a token issued via consent looks like:
{
"iss": "https://auth.securely.io",
"aud": "https://api.securely.io",
"sub": "your-client-id",
"client_id": "your-client-id",
"party_type": 3,
"business_id": 42,
"merchant_id": 7,
"iat": 1735000000,
"exp": 1735003600
}See Access Tokens and Refresh Rotation for full claim details.
If the user wants to switch businesses
The access token is bound to one business. There's no "switch business" API on an existing token. To access a different business, send the user through /oauth/authorize again — they'll log in (or use their existing session), pick a different business at the consent screen, and your app receives a new access token bound to the new business.
Updated 5 months ago
What’s Next
Access Tokens and Refresh Rotation — what's inside the access token, and why refresh tokens are one-time-use.
