GetSupportX
Portal sign-in docs
For developers

Protocol reference

Everything the code in the platform guides does, for writing your own: a signed redirect from your server to your portal’s callback URL.

In one paragraph

When a logged-in customer opens your sign-in link, your server builds a small JSON payload saying who they are, base64-encodes it, signs the base64 text with HMAC-SHA256 using your secret key, and redirects the browser to your callback URL with ?payload= and &sig=. We check the signature and the expiry, find or create the customer, and open the portal signed in. Signing needs the secret key, so it always happens on a server, never in the browser.

Callback URL

Shown in Settings → Help center & portal → Portal sign-in under “For developers” in step 2 (Add the code to your website), and already filled in when you copy the code from there. It has one of two forms, which behave the same:

Callback URL forms
Your help center is onCallback URL
GetSupportX’s addresshttps://<app address>/portal/<your-workspace>/handoff
Your own domain (verified)https://<your-domain>/portal/handoff

Copy the one Settings shows; don’t build it by hand. The guides’ code on these docs pages has https://<your-help-center>/portal/handoff in its place: replace that whole address. Once a custom domain is verified, Settings switches to it.

The request

A browser redirect from your server (the guides use 302)
GET <callback URL>?payload=<base64 JSON>&sig=<hex HMAC-SHA256>[&redirect=<portal path>]

Payload encoding

  • JSON, encoded as UTF-8, then standard base64. Put it in the URL with URL-encoding (encodeURIComponent, rawurlencode, quote(…, safe="")): a raw + in a query string reads as a space, and the signature then fails.
  • Keep it small: it rides in a URL. A few hundred characters of profile data is fine; don’t send large blobs.

Signature

  • HMAC-SHA256 of the base64 text exactly as you send it, not of the JSON.
  • The key is your secret key used as text, exactly as Settings showed it (64 characters). Don’t hex-decode it.
  • Sent as a hex digest. Upper or lower case both work: we lower-case it before checking it, and before the one-time check.
Signing, step by step
// Node.js — the same steps in every language
const json = JSON.stringify(payload);                        // 1. JSON
const b64 = Buffer.from(json, "utf8").toString("base64");    // 2. base64 (standard)
const sig = crypto.createHmac("sha256", process.env.GSX_SSO_SECRET)
  .update(b64)                                               // 3. sign the base64 TEXT
  .digest("hex");                                            //    hex digest
const url = CALLBACK + "?payload=" + encodeURIComponent(b64) // 4. URL-encode it
  + "&sig=" + sig;

Required and core fields

Required and core payload fields
FieldRequiredTypeRules
externalIdYesText (or a whole number)Your id for this customer. It must never change and never be reused: it is what keeps their requests together. Prefix it with your site (the guides use yourwebsite.com:42) if more than one website uses your workspace.
expYesNumber: Unix time in secondsIn the future, and no more than 600 seconds (10 minutes) ahead. Use now + 300. Seconds, not milliseconds.
iatNoNumber: Unix time in secondsWhen sent, exp − iat must be 600 or less.
jtiNo (the guides’ code sends one)Text: 32–128 hex charactersA random id for this one link (16 or more random bytes, as hex). Every guide’s code sends a fresh one. Any other value is ignored. See one-time links.
emailNoTextThe customer’s email. Updated on their profile when it changes. See email.
siteNoText: an http(s) originYour website’s origin, for example https://yourwebsite.com. Says externalId is prefixed. If sent, it must be a valid http or https address with no user name or password, or the sign-in (and a connection check) is refused.
legacyExternalIdNoText or whole number, 1–200 charactersYour older, unprefixed id for the same customer. Only used together with site. See changing ids.
testNotrueA connection check. See connection checks.
Example payload, before base64
{
  "externalId": "yourwebsite.com:42",
  "site": "https://yourwebsite.com",
  "email": "[email protected]",
  "name": "Alice Jones",
  "plan": "Pro",
  "mrr": "$49",
  "attributes": { "orders": 14 },
  "jti": "9f2c4e1a7b3d5f60a8c2e4b6d8f01357",
  "iat": 1795000000,
  "exp": 1795000300
}

Optional customer details

Send any of these and your team sees them next to the customer’s requests. They are updated every time the customer signs in, so you don’t need a separate sync.

Optional customer-detail fields
FieldTypeLimitWhat it’s for
nameTextUp to 200 characters; longer is cutThe customer’s name, as your team sees it.
phoneTextUp to 200 characters; longer is cutPhone number, on the customer’s profile.
avatarTextUp to 200 characters; longer is cutA picture URL, stored on the customer’s profile.
localeTextUp to 200 characters; longer is cutLanguage and region, for example en-GB.
timezoneTextUp to 200 characters; longer is cutIANA time zone, for example Europe/London. Your team sees the customer’s local time.
planText, number or true/falseText up to 500 charactersPlan name. Shown in the customer’s billing details.
seatsText, number or true/falseText up to 500 charactersNumber of seats. Shown in the billing details.
subscriptionStatusText, number or true/falseText up to 500 charactersFor example active, trialing or past due. Shown in the billing details.
mrrText, number or true/falseText up to 500 charactersMonthly revenue, shown as you send it (send “$49” or 49).
renewsText, number or true/falseText up to 500 charactersRenewal date, shown as you send it.
paymentText, number or true/falseText up to 500 charactersPayment method, for example “Visa ending 4242”. Shown as you send it.
ltvText, number or true/falseText up to 500 charactersLifetime value, shown as you send it.
roleText, number or true/falseText up to 500 charactersTheir role at their company. Shown under custom data.
websiteText, number or true/falseText up to 500 charactersTheir website. Shown under custom data.
companyText, number or true/falseText up to 500 charactersTheir company name, stored as text under custom data. Customers are linked to companies by their email domain, not by this field.
attributesObject of key → text, number or true/falseKeys up to 60 characters, values up to 500Anything else you want your team to see, shown under custom data. Nested objects and lists are dropped.
  • Only fields you send are written. A field you leave out keeps its value, including anything your team typed by hand. Empty text and null are skipped too.
  • Custom data is merged with what’s stored, never replaced. At most 30 custom values are kept from one sign-in, counting the top-level ones above.
  • Keys starting with __ are reserved and ignored. Nested objects and lists are dropped, not stored.
  • Values over a limit are cut, not refused: the sign-in still works.

Expiry and clocks

We check exp against our clock when the link arrives. Build the signed link at the moment the customer opens your sign-in link, never earlier (for example, into a page when it loads), and keep your server’s clock in sync. A link that arrives after exp is refused as expired; one whose exp is more than 10 minutes ahead is refused as too long.

One-time links

Each signed link works once. The first use signs the customer in; any later use of the same link is refused (and after exp it would be refused as expired anyway). With a valid jti we remember the link by that id; without one, by its payload and signature. The signature’s case doesn’t matter, so re-casing a used link doesn’t make it new.

Every guide’s code sends a fresh jti, iat and exp on every click. Writing your own code? Do the same, and never let a page cache or CDN store the redirect (send Cache-Control: no-store).

Customer ids and several websites

We find the customer by externalId within your workspace. If two websites share one workspace, their user number 5s are different people, so the guides prefix ids with the site (yourwebsite.com:5, or wp:<site key>:5 on WordPress) and send site. We treat externalId as opaque text and never take it apart.

Changing ids (legacyExternalId)

Moving from bare ids (5) to prefixed ones? Send the new externalId, plus site and the old id as legacyExternalId. If no customer has the new id yet, we look up the one stored under the old id and move them to the new id, keeping their requests, but only when the email you send matches theirs. Otherwise the old customer is left alone and a new one is created. legacyExternalId is ignored without site.

Email

If no customer has this externalId but one with the same email has written to you before (and isn’t linked to another id), they are linked to this id and keep their history. If that email already belongs to a customer linked to a different id, the sign-in is refused rather than merging two people. Send only email addresses your site has confirmed; here’s why.

Landing page: the redirect parameter

Add &redirect=<path> to the callback URL to choose which portal page the customer lands on. It is not signed, so we only follow it when it is a plain path inside your portal. A portal path in either form is accepted, whichever address your callback is on, and is moved to that address:

Accepted redirect paths
You sendFormThe customer lands on
/portal/<your-workspace>/…GetSupportX’s addressThat page, on the address your callback is on
/portal/…Your own domainThat page, on the address your callback is on
Anything elsePortal home

For example, /portal/<your-workspace>/t/5 sent to a callback on your own domain lands on /portal/t/5 there. Full addresses, other sites, other workspaces’ portals, other parts of the app, and tricks such as //, backslashes or .. all land on the portal home. The redirect can never change who is signed in.

The return path (gsx_return)

When a customer heading to a specific portal page (a request they opened from an email, say) clicks your portal’s sign-in button, we add that page to your sign-in link as ?gsx_return=<path> (or &gsx_return= when your link already has a query, like WordPress’s ?gsx_support=1). It is left off for the portal home. Your code should:

  • pass it to the callback as &redirect=, URL-encoded, when it starts with / (but not // or /\);
  • keep it when it sends a logged-out visitor to log in first, so it is still there when they come back (the guides send your login page the full sign-in address as next).

Your code’s check only avoids passing on junk; ours on the callback is the one that counts.

The guides’ code does all of this, and so does the WordPress plugin from version 0.5.2. Older plugins (0.5.1 or earlier) ignore gsx_return, so their customers land on the portal home.

Connection checks (test: true)

A payload with "test": true goes through the same checks as a sign-in (signature, exp, the 10-minute limit, a malformed site) and fails in the same way. Then it stops. The only differences: nobody is signed in, no customer is created, and the link is not used up. The callback answers 200 with {"ok":true,"test":true} instead of a redirect. It shows in Settings as the last connection check from your site. externalId is still required.

What happens next

Callback results
ResultThe browser goes toWhere you see it
Signed inThe portal (or the redirect page), signed in“Last sign-in through your website”
RefusedYour portal’s sign-in page with ?error=sso: one short message, and the emailed link still worksThe reason, under recent failed sign-ins. Every reason
Connection checkNowhere: 200 JSON for your code“Last connection check from your site”

Where to look

Settings → Help center & portal → Portal sign-in → Check it works shows the last sign-in, the last connection check and the 5 most recent failures. We keep them for 30 days (up to 10 failures).

Login provider (OIDC)

Sign in with your login provider makes your portal an OpenID Connect relying party: your provider signs the customer in, and nothing runs on your website. Everything above is for sign-in through your website; this section is the whole of the OIDC side. Setup guide

Redirect URIs

OIDC redirect URIs
The sign-in starts onRedirect URI to register
GetSupportX’s addresshttps://<app address>/portal/<your-workspace>/oidc/callback
Each verified custom domainhttps://<your-domain>/portal/oidc/callback

Register each one exactly; Settings shows them with Copy buttons. The portal’s button goes to …/oidc/start on the same address, carrying ?redirect= with the page the customer wanted, under the same rules as the redirect parameter.

Flow

  • Authorization code flow (response_type=code) with PKCE (S256), state and nonce. Scope: openid email profile.
  • State, nonce and the PKCE verifier live in one encrypted, HttpOnly cookie for 10 minutes, tied to your workspace. The callback deletes it whatever the outcome, so each sign-in can finish once.
  • Settings come from <issuer>/.well-known/openid-configuration, which must name the same issuer, give https endpoints and support the code flow. Save stores the provider’s own spelling of the issuer. Signing keys come from its jwks_uri, cached for an hour and fetched again (at most once a minute) when a token names a key we don’t have. A provider that names itself on the way back (iss, RFC 9207) must name the same issuer.
  • Confidential client. The secret goes to the token endpoint as client_secret_basic when the provider offers it (or lists nothing), else as client_secret_post. We never follow a redirect from the token endpoint, so the secret can’t be replayed to another host.

ID token checks

  • Signed, not encrypted. Accepted algorithms: RS256, RS384, RS512, PS256, PS384, PS512, ES256, ES384, and only those your provider also lists. HS256, HS384, HS512 and none are refused: the algorithm is ours to choose, never the token’s.
  • The key must fit the algorithm (type, curve, use of sig), is picked by kid, and an RSA key needs 2048 bits or more. Tokens with crit headers are refused.
  • iss equals the saved issuer exactly. aud is your client ID and nothing else (azp, if sent, too). exp is in the future and iat within the last 10 minutes, with 2 minutes’ allowance for clocks. nonce matches this sign-in. sub is present.

Who the customer is

  • Identity is issuer plus sub, stored as the customer id oidc:<issuer key>:<sub>, where the issuer key is the first 12 hex characters of the SHA-256 of the issuer. The email is never an identifier.
  • email is stored and matched only when email_verified is the boolean true. Microsoft Entra sends no email_verified, so those customers are known by sub alone.
  • Lookup order: the customer already holding this identity; else, with a verified email, the customer who owns that email, who gets this identity added and keeps their history (their website id is left alone, so both sign-in methods keep working); else a new customer.
  • name (or given_name + family_name) fills in a missing name; it never overwrites one.

A refused sign-in lands on your portal’s sign-in page with ?error=oidc; the reason goes to Check it works. Every OIDC reason

Read next