Skip to main content
Enterprise SSO lets your own product work with Mihu on behalf of your users. Your users click Connect with Mihu, approve the permissions your application asks for, and your application can then call the Mihu API as that user: list their AI agents, start campaigns, read conversations, whatever the approved permissions allow. Nobody shares a password or a workspace-wide API key. Every connection belongs to one person, is limited to what they approved, and can be switched off by them or by their workspace at any moment.
Enterprise SSO is part of the Enterprise plan and is switched on for your workspace on request. Contact your Mihu account manager or support@mihu.ai to enable it.

When to use it

  • You run a platform, a marketplace or an internal tool, and your users also use Mihu.
  • You want to show or change Mihu data inside your product without asking each customer for an API key.
  • You need every action to be attributed to the person who approved it, with the same permissions they have in Mihu.
If you only need to call the API for your own workspace, a regular API token is simpler. See Authentication.

How onboarding works

1

Enterprise SSO is enabled

We switch on the SSO layer for your Enterprise workspace.
2

Your application is registered

You send us your application’s name, logo, the redirect URIs your users should return to, and the permissions your application needs, for example agents, contacts and campaigns. We register it and send you a client ID and a client secret. The secret is shown once; store it on your server.
3

You add the Connect button

Your application sends users to the Mihu consent screen and exchanges the result for tokens, as described below.
4

Your users connect

Each user approves once. From then on your application calls the Mihu API with their token and keeps it fresh in the background.
Redirect URIs must use HTTPS and are matched exactly. Only the permissions you registered can ever be requested. Open this address, usually in a popup. https://acme.mihu.ai stands for your user’s workspace address; every request in this guide goes to that address.
The user signs in to Mihu if needed and sees which permissions your application asks for.
  • Allow: the browser returns to your redirect URI with a one-time code.
  • Cancel: the browser returns with error=access_denied.
  • Missing permissions: if the user’s own Mihu account lacks any of the requested permissions, Allow is disabled and the missing ones are listed. There are no partial grants.
Check that state matches what you sent. The code works once and expires after 60 seconds.

2. Exchange the code for tokens

Do this on your server, never in the browser.
Store, per connection: the workspace address, the access token, its expiry time and the refresh token. The access token lasts 1 hour and the refresh token 30 days, unless agreed otherwise when your application is registered.

3. Call the API

Send the access token in the Authorization header on every request.
  • The token only opens what the user approved. Anything else answers 403.
  • Access always follows the user’s current permissions in Mihu. If their role changes, your access changes with it, immediately.
  • Every action is recorded under the user who approved the connection.
Keep tokens on your server. Never put them in a URL, in browser storage or in client-side code.

4. Keep the connection alive

Refresh a few minutes before the access token expires, or when a call answers 401.
The answer has the same shape as step 2, including a new refresh token.
  1. Always store the new refresh token. The old one stops working the moment the refresh succeeds.
  2. Refresh from one place at a time. Using an old refresh token again is treated as a stolen token and ends the whole connection, so two parallel refreshes for the same connection will break it.
  3. invalid_grant means the connection is over. Mark it as disconnected and ask the user to connect again.

5. Disconnect

When a user disconnects inside your application, revoke the connection so it disappears from their Mihu account too.

Who can switch a connection off

Connections can end from the Mihu side at any time. Your application should expect that and simply ask the user to connect again.

When calls fail

What is inside the access token

You do not need to read the token, but you can. It is a signed JWT (RS256), and the public keys are published at https://acme.mihu.ai/.well-known/jwks.json.

Checklist before you go live

  • The client secret and all tokens are stored on your server only.
  • You check state on every return from the consent screen.
  • You store the new refresh token after every refresh, and refresh one connection at a time.
  • You handle 401, 403 and invalid_grant by refreshing, stopping or asking the user to reconnect.
  • You offer a Disconnect option that calls the revoke endpoint.