Ppolarapi
Home/Single Singal integration
Sign in ↗
IDENTITY PROVIDERS / SINGLE SINGAL

Single Singal
integration guide.

PolarAPI uses Single Singal as an external identity service. Dashboard sessions remain PolarAPI-owned and independent. All documented Single Singal API requests are made server-side.

i
Contract note

This integration follows the documented endpoints below only. Single Singal is not OAuth or OIDC and does not provide an SDK.

01 / OVERVIEW

How sign-in works

  1. RedirectA plain link sends the browser to https://singlesingal.aavrit.dedyn.io/polarapi.
  2. Verify onceSingle Singal returns the browser to PolarAPI with a one-time token. PolarAPI's server verifies it at POST /api/sign/verify.
  3. Own sessionOn success, PolarAPI creates a server-side session indexed by the stable user.id. It never matches accounts by email or username.
  4. Refresh identityFor signed-in requests, the server fetches the current profile and access state, caching successful results for at most 60 seconds.
02 / SERVER CONFIGURATION

Server-only credentials

Set these values in the deployment's server environment. Never add them to browser bundles, public environment variables, source control, or logs.

SINGAL_API_KEY=<server-side API key>
SINGAL_WEBHOOK_SECRET=<webhook signing secret>

PolarAPI uses the project UID polarapi and the service base URL https://singlesingal.aavrit.dedyn.io. Every documented server API call uses:

Authorization: Bearer <SINGAL_API_KEY>
Content-Type: application/json
03 / BROWSER RETURN

Verify a one-time sign-in token

The registered return route is https://polarapi.us.ci/api/singal/callback/{userId}+{oneTime}. The two token parts are one path segment joined by a literal plus (which may arrive encoded as %2B).

The PolarAPI server makes exactly one request. One-time tokens expire after five minutes and cannot be retried.

POST https://singlesingal.aavrit.dedyn.io/api/sign/verify
Authorization: Bearer <SINGAL_API_KEY>
Content-Type: application/json

{
  "project": "polarapi",
  "token": "<userId>+<oneTime>"
}

Only HTTP 200 with {"ok":true,"authentic":true,"user":{"id":...}} is accepted. A failed or reused token returns a sign-in failure page with a fresh sign-in link. The token is never persisted or logged.

04 / LIVE IDENTITY

Check current access

Profile information is refreshed from the identity service rather than treated as permanent callback data.

POST https://singlesingal.aavrit.dedyn.io/api/sign/user
Authorization: Bearer <SINGAL_API_KEY>
Content-Type: application/json

{
  "project": "polarapi",
  "userId": "<singalUserId>"
}

HTTP 200 with {"ok":true,"active":true,"user":{...}} supplies the current name, username, email, and photo. The successful response is cached for no more than 60 seconds.

{
  "ok": true,
  "active": true,
  "user": {
    "id": "user-id",
    "passport_id": "passport-id",
    "name": "Example User",
    "username": "example",
    "email": "user@example.com",
    "photo_url": "https://example.com/photo"
  }
}
05 / INSTANT REVOCATION

Signed webhook

Registered address: https://polarapi.us.ci/api/singal/webhook. The public POST route reads the raw body before parsing JSON. It validates X-Singal-Timestamp (Unix seconds, within 300 seconds) and X-Singal-Signature using a constant-time comparison.

message = timestamp + "." + raw_body
expected = "sha256=" + lowercase_hex(
  HMAC_SHA256(SINGAL_WEBHOOK_SECRET, message)
)

Supported events are ping and access.revoked. A ping is acknowledged without changing access. A valid revocation deletes the user's PolarAPI profile and all PolarAPI sessions. Supported reasons: user_revoked, user_revoked_all, passport_deleted, admin_revoked. Events are idempotently recorded and acknowledged promptly.

{
  "event": "access.revoked",
  "project": "polarapi",
  "userId": "user-id",
  "reason": "user_revoked",
  "at": "<timestamp>"
}
06 / POLARAPI GATEWAY

Identity operations through PolarAPI

PolarAPI can expose these documented operations from a published project integration. The upstream paths below are the only Single Singal API paths used for these operations; PolarAPI applications authenticate with their own PolarAPI API key, never the Single Singal server credential.

POST /v1/integrations/singlesingal/sign/verify
POST /v1/integrations/singlesingal/sign/user

Gateway operation routes are not yet published in this build. No unsupported gateway endpoint is advertised as operational.

07 / FAILURE BEHAVIOR

Errors and caching

  • Sign-in failed vs unavailable. A rejected, expired, or reused one-time token shows the sign-in-failed page — start sign-in again for a fresh token (tokens expire after five minutes and cannot be retried). Missing server credentials or a Single Singal outage shows the unavailable page (503) instead. Check GET /api/health on the workspace or gateway host: it reports whether each Worker secret is configured as a boolean only, never the secret value.
  • Only the exact documented HTTP 403 response {"active":false,"error":"access_revoked"} revokes a PolarAPI session.
  • Network errors and HTTP 5xx responses do not revoke access. The signed-in page reports a temporary upstream problem.
  • Other failed or invalid sign-in verification responses refuse authentication and require a new one-time token.
  • Successful access responses are cached for a maximum of 60 seconds; revocation events clear the cache immediately.
  • Raw credentials, session identifiers, and one-time tokens are not included in application logs or client responses.
08 / SECURITY & LIMITATIONS

Keep the boundaries clear

  • PolarAPI dashboard authentication is separate from Single Singal server API authentication.
  • The dashboard uses a PolarAPI-owned, opaque, server-side session. Sign-out ends only this session and does not call Single Singal.
  • Stable user identity is keyed only by Single Singal's user.id, never email or username.
  • This integration is not OAuth, not OIDC, provides no SDK, and uses no discovery document, authorization-code flow, or undocumented claims.
  • Callback profile fields are refreshed from the documented user API and are not treated as authoritative permanent identity data.
Sign in with Single Singal ↗
END OF GUIDE · POLARAPI / SINGLE SINGAL