# sso-multitenant (`periwinkle_ballet/sso-multitenant`) Actor

- **URL**: https://securitybyobscurity.apify.com/periwinkle_ballet/sso-multitenant.md
- **Developed by:** [Nishad Manerikar](https://securitybyobscurity.apify.com/periwinkle_ballet) (community)
- **Features:** Limited permissions, Multi-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://securitybyobscurity.apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://securitybyobscurity.apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## SSO Multi-tenant Standby Test

A minimal multi-tenant Standby Actor for testing Console SSO (`actorStandby.isConsoleAuthEnabled`). Open it in a browser without a token, log in with your Apify account, and the page shows the identity the standby controller forwarded for your request.

### Setup

1. Push and build the Actor (`usesStandbyMode: true` enables Standby).
2. In the Actor's Standby settings set **Tenancy** to **Multi-tenant**. The Actor has no pricing, so it is a free multi-tenant Actor: every caller is routed to the owner's pool.
3. Enable **Console auth** (`isConsoleAuthEnabled`). This setting is admin-only.

### What to check

Open the standby URL (`https://<user>--sso-multitenant-standby.apify.actor`) in a browser, without `?token=`:

1. You get the controller's login page, and `/.actor/login` sends you through Console OAuth.
2. After the callback, `/` loads and shows:
   - `userId`: your user ID (`X-Apify-User-ID`), or your organization's when acting as one.
   - `basicUserInfo`: the decoded `x-apify-basic-user-info` header (user and impersonated user). It is only sent for SSO requests, so it is `null` when you call with a token.
   - `requestId`: the `X-Actor-Request-ID` the controller minted.
   - `cookieSeenByActor` and `authorizationSeenByActor`: both should be empty, because the controller strips its `apify_standby_auth` cookie and the token before proxying.
   - `runUserId`: the account the run lives in. For multi-tenant this is the Actor owner, for every caller.
3. The same-origin `fetch('/whoami')` on the page should return 200: the session cookie also authenticates subresource requests.
4. Log in as a second user (another browser profile) and confirm `userId` changes while `runUserId` stays the owner, and that both users hit the same run.
5. `/.actor/logout` clears the session; the next load shows the login page again.
6. `curl` with a token still works and shows `basicUserInfo: null`.

### Endpoints

- `GET /`: HTML page with the forwarded identity and the fetch probe.
- `GET /whoami`: the same identity as JSON.

No dependencies; plain `node:http`.

# Actor input Schema

## Actor input object example

```json
{}
```

# Actor output Schema

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("periwinkle_ballet/sso-multitenant").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("periwinkle_ballet/sso-multitenant").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call periwinkle_ballet/sso-multitenant --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,periwinkle_ballet/sso-multitenant"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console-securitybyobscurity.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api-securitybyobscurity.apify.com/v2/actors/aUhOcZQ5QezlKzmpW/builds/pJAU5NkcyXmclalHM/openapi.json
