360 Secure SkillHub
360 安全技能中心

Crossly OAUTH apps

提供在 Crossly 上注册第三方 OAuth 应用的完整步骤,涵盖机密/公开客户端、精确重定向 URI、可授予作用域、Atlas 授权码与 PKCE 流程、令牌轮换与撤销、应用 webhook、商品链接、收益分成、目录上架、审核、健康检查与沙箱测试,并附 API 和 SDK 示例。

分类:开发
crossly
热度 9.16
最近更新 2026-11-30 11:11:13

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add crossly/crossly-oauth-apps
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
crossly-oauth-apps
description
Build a third-party app on Crossly. Register an OAuth app for a store (POST /v1/developer/apps, clientSecret shown once), pick confidential vs public, exact-match redirect URIs, request only grantable scopes (never *, billing:write, team:*, payouts:write, funding:*, apps:*), run the Atlas authorization-code + PKCE S256 flow (issuer https://crossly.net/atlas, resource=https://crossly.net/api/v1, 8 h JWT access tokens, rotating refresh tokens, revoke), register app-owned webhooks filtered by granted scopes, link app-managed listings (POST /v1/listings/link, listings:manage, listing commands, orders:manage), set revenue share, read app health (GET /v1/developer/apps/{appId}/health) and list the app in the directory (PUT /v1/developer/apps/{appId}/listing). Use when building an integration other Crossly sellers install, debugging OAuth errors (invalid_scope, owner_only, app_not_verified), or managing an app's profile, review, earnings or sandbox.

Build a third-party OAuth app on Crossly

A personal access token is for your own scripts. Software that other sellers install is an OAuth app: the seller clicks Connect, sees Crossly's consent screen, and your app gets scoped tokens for their account. Every app belongs to one of your stores, which is paid what the app earns. For the token basics and base URLs see crossly-api-setup; for pagination, errors, rate limits and idempotency see crossly-api-conventions.

Setup

  1. Create a free Crossly account: https://crossly.net/register
  2. Create a personal access token at https://crossly.net/settings/api/tokens/new (guide: https://crossly.net/guides/personal-access-tokens). Use a crossly_pat_test_ token against the sandbox while building.
  3. Export it as CROSSLY_PAT and send it as Authorization: Bearer $CROSSLY_PAT to https://crossly.net/api/v1/*. Full docs: https://crossly.net/docs

1. Register the app

Dashboard: Settings → API & developers → Your OAuth apps → New app. Over the API, with your own PAT (apps:read to read, apps:write to write; no app token can ever hold apps:*):

Method and path Scope Does
GET /v1/developer/apps apps:read Your stores' apps. ?storefrontId, q, status (live, in_review, listed, needs_store, revoked, all), page, pageSize (max 100). meta.stores = stores you may register apps for
GET /v1/developer/apps/{appId} apps:read One app with its owning store
POST /v1/developer/apps apps:write Register. 201; data.clientSecret is returned once (null for a public client)
PATCH /v1/developer/apps/{appId} apps:write Name, redirect URIs, scopes, revenue share. Existing installs keep the terms they agreed to
PUT /v1/developer/apps/{appId}/store apps:write { storefrontId }: move the app to another store of the same business. Unpaid earnings move; client id, secret, installs and webhooks don't

Body of POST (the OpenAPI spec does not describe it; these are the zod limits in the route):

Field Type / limits
name required, 1–80 chars
redirectUris required, 1–10, each ≤ 500 chars, no duplicates
scopes required, ≥ 1, the app's ceiling
isPublic boolean, default false (confidential)
storefrontId uuid; default the store in X-Storefront-Id, else your default store. None: 409 (reason: store_required)
description (≤ 500), homepageUrl, logoUrl (URLs ≤ 500) optional
monetization free | revenue_share
revShareBps integer 0–5000 (5000 = 50 % of the seller's take-home, the ceiling)
revShareCapCents, revShareMinOrderCents integer cents
payoutMethod external | cbx
import { createClient } from '@crossly/sdk';
const crossly = createClient({ pat: process.env.CROSSLY_PAT! }); // apps:write

const { data: app } = await crossly.apps.register({
  name: 'LabelBot',
  redirectUris: ['https://labelbot.example/oauth/callback', 'http://localhost:5173/callback'],
  scopes: ['openid', 'offline_access', 'orders:read', 'fulfillment:write', 'webhooks:write'],
  isPublic: false,
});
// app.clientId, app.clientSecret (store it now: it is never shown again)

Other SDK methods: crossly.apps.mine(), mineOne(appId), update(appId, input), setStore(appId, storefrontId).

curl -X POST https://crossly.net/api/v1/developer/apps \
  -H "Authorization: Bearer $CROSSLY_PAT" -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"name":"LabelBot","redirectUris":["https://labelbot.example/oauth/callback"],"scopes":["openid","offline_access","orders:read","fulfillment:write"]}'

Confidential vs public

Confidential (isPublic: false) Public (isPublic: true)
For a server that can keep a secret SPAs, mobile, desktop, CLIs
Secret shown once; rotate on the app card (rotating disconnects nobody) none
Token endpoint auth HTTP Basic (client_secret_basic) client_id only
PKCE S256 required required

Redirect URIs

Matched exactly: no wildcards, no trailing-slash forgiveness, no #fragment. https:// anywhere; http:// only for localhost, 127.0.0.1 or [::1]; custom schemes (myapp://callback) are allowed. Anything else is a 400 at registration. An unknown client_id or unregistered redirect_uri is never redirected back to.

2. Scopes an app may request

The app declares a ceiling at registration and requests any subset at authorize time. A scope outside the ceiling, an unknown scope, or a forbidden one is rejected (invalid_scope), never silently trimmed.

Rule Scopes
Never grantable to a third-party app (THIRD_PARTY_FORBIDDEN_SCOPES) *, billing:write, team:read, team:manage, payouts:write, funding:write, funding:approve, apps:read, apps:write, worlds:stats:read, worlds:versions:publish, worlds:badges:write, worlds:messaging:publish
Crossly's own apps only (FIRST_PARTY_ONLY_SCOPES) world, world:rooms, world:spend, session:handoff
Review-gated (REVIEW_GATED_SCOPES): work for your own account at once, for others after review worlds:play (client certification), worlds:publish, worlds:monetize (app verification)

Using a gated scope on someone else's account before review is 403 app_not_certified or 403 app_not_verified (app_revoked if Crossly revoked the app). The docs pages still list only six forbidden scopes; the code list above is what is enforced. Least-privilege examples: crossposter inventory:read listings:write; shipping tool orders:read fulfillment:write; reporting sales:read analytics:read. Full catalog: GET /v1/pat/scopes.

3. The authorization flow (Atlas)

Issuer https://crossly.net/atlas. Discovery: https://crossly.net/atlas/.well-known/openid-configuration (also /.well-known/oauth-authorization-server/atlas). The API's protected-resource metadata is /.well-known/oauth-protected-resource/api/v1, and a 401 from the API points there in WWW-Authenticate.

Authorize. Send the seller to:

https://crossly.net/atlas/oauth2/authorize?response_type=code
  &client_id=APP_ID&redirect_uri=https%3A%2F%2Flabelbot.example%2Foauth%2Fcallback
  &resource=https%3A%2F%2Fcrossly.net%2Fapi%2Fv1
  &scope=openid%20offline_access%20orders:read%20fulfillment:write
  &state=RANDOM&code_challenge=BASE64URL_SHA256_OF_VERIFIER&code_challenge_method=S256
  • openid is required on every request; offline_access gets you a refresh token.
  • resource=https://crossly.net/api/v1 names the API the token is for.
  • PKCE is required for every client and only S256 is accepted.

Consent. The seller signs in if needed and sees your app, its developer, each scope in plain words and your revenue-share terms. On re-consent the screen calls out what is new. A team member acting inside someone else's account cannot connect an app: the consent answers 403 owner_only; the owner must do it.

Exchange the code.

curl -X POST https://crossly.net/atlas/oauth2/token -u "$APP_ID:$APP_SECRET" \
  -d grant_type=authorization_code -d code="$CODE" -d code_verifier="$VERIFIER" \
  -d redirect_uri=https://labelbot.example/oauth/callback -d resource=https://crossly.net/api/v1
# { access_token, token_type: "Bearer", expires_in, refresh_token, scope }

A public client drops -u and sends -d client_id=$APP_ID.

import { createHash, randomBytes } from 'node:crypto';
const verifier = randomBytes(32).toString('base64url');
const challenge = createHash('sha256').update(verifier).digest('base64url');
// keep verifier + state server-side (session) until the callback

Tokens.

Access token a JWT (eyJ…), aud = https://crossly.net/api/v1, lives 8 hours. Send Authorization: Bearer <jwt> to https://crossly.net/api/v1/...
Refresh grant_type=refresh_token at the same token endpoint. The refresh token rotates: store the new one every time. A retry with the previous one within 30 s returns the same new token; after that, reuse ends the whole grant
Revoke POST https://crossly.net/atlas/oauth2/revoke
Who the user is GET https://crossly.net/atlas/oauth2/userinfo (needs openid)

@crossly/sdk 0.3.0 accepts a JWT in the pat field: createClient({ pat: accessToken }). Old crossly_oat_… tokens are no longer accepted. The legacy URLs https://crossly.net/oauth/authorize and https://crossly.net/api/oauth/token hand over to Atlas until 2027-01-15; use the Atlas URLs. Consoles and terminals can use the device flow (advertised in discovery).

Rate limits key on app + seller, so your app has its own bucket per seller and cannot burn the seller's dashboard quota.

4. Disconnects and revocation

Who Where Effect
Seller Settings → API & developers → Connected apps, or DELETE /v1/connected-apps/{grantId} (accounts:write; list with GET /v1/connected-apps, accounts:read) The grant, its access and refresh tokens, and the webhooks your app registered for that seller are gone at once
You Revoke the app on its card Every seller's grant
You Rotate the secret Nothing is disconnected

Narrowing a grant narrows tokens already issued under it. Handle 401 invalid_token as "this seller disconnected": stop calling, mark the install inactive, offer reconnect.

5. App-owned webhooks

Register with the seller's app token: POST /v1/webhooks (webhooks:write). An app's subscription:

  • belongs to the app: another app (or the same app for another seller) cannot list, test or delete it; the seller's own credential sees all of the seller's webhooks;
  • only receives events the grant holds the matching read scope for, e.g. order.*, refund.*, return.* need orders:read; sale.* needs sales:read or orders:read; listing.* needs listings:read; inventory.* needs inventory:read; message.* needs inbox:read or messages:read; connection.* needs accounts:read; automation.* needs automation:read. webhooks:write alone receives nothing but test.ping;
  • is deleted when the seller disconnects.

Test with POST /v1/webhooks/{id}/test. Signature verification, retries and the event list are in crossly-webhooks.

6. App-managed listings

If your app already runs a seller's marketplace listings (an eBay lister, say), link them instead of re-listing. These calls need an app token with listings:manage; a seller PAT is 403 app_token_required.

Method and path Scope
POST /v1/listings/link (one, idempotent: outcome linked | already_linked) listings:manage
POST /v1/listings/link/bulk (≤ 100 items, per-item errors in data) listings:manage
POST /v1/listings/{id}/events, POST /v1/listings/events (≤ 100) listings:manage
GET /v1/listing-commands, POST /v1/listing-commands/{id}/ack | complete | fail listings:manage
POST /v1/orders/events (≤ 100: order.shipped, order.delivered, order.cancelled, order.refunded) orders:manage
POST /v1/listings/{id}/unlink listings:manage (your app) or listings:write (the seller)
GET /v1/listings/{id}/management listings:read or listings:manage
  • Direct channel (the seller connected that marketplace in Crossly): Crossly verifies the item by id and acts itself. Relayed: you must send a snapshot (title, price in dollars, quantity, status) or get 422 snapshot_required, and Crossly sends you commands (delist, update, relist; with orders:manage also submit_tracking, remove_tracking, cancel_order, refund_order, message_buyer).
  • Events need eventId (idempotent per app: replay = duplicate) and a per-listing increasing sequence (older state events = stale, a 200). item.sold runs the normal sale cascade and is never stale.
  • Commands: ack (extends the deadline: 24 h for listing commands; tracking 2 h, cancel 4 h, refund 24 h, message 1 h), then complete or fail (reason, permanent). Late or cancelled = 409 command_state_conflict.
  • Managing-app webhooks: listing.linked, listing.unlinked, listing.updated, listing.delist_requested, listing.update_requested, listing.relist_requested, listing.command_expired.
const crossly = createClient({ pat: accessToken }); // the seller's Atlas access token
const link = await crossly.appManaged.link(
  { platform: 'ebay', externalId: '1234567890', snapshot: { title: 'Vintage tee', price: 24.5, quantity: 1, status: 'active' } },
  { idempotencyKey: crypto.randomUUID() },
);
const { data: open } = await crossly.appManaged.listCommands();
for (const cmd of open) {
  await crossly.appManaged.ackCommand(cmd.id);
  // ...act on the marketplace...
  await crossly.appManaged.completeCommand(cmd.id);
}

Other errors: managed_by_another_app (409), not_managing_app (403), item_not_found (404), item_not_active (422), item_not_owned (403), external_id_linked_elsewhere (409), event_invalid (422), platform_unavailable (502, retry).

7. Revenue share and earnings

Set monetization: "revenue_share" with revShareBps (≤ 5000), optional revShareCapCents and revShareMinOrderCents. The fee applies only to Crossly Shop sales of listings your app manages or creates, never to eBay or other marketplaces. Each seller's terms are frozen on their grant at consent; raising your rate affects new installs only. Read earnings with GET /v1/apps/{id}/earnings (apps:read, SDK crossly.apps.earnings(appId)) and the listing allowance with GET /v1/apps/{id}/listing-allowance (crossly.apps.listingAllowance(appId)).

8. Directory profile, listing and review

Method and path Scope
GET /v1/developer/apps/{appId}/profile (fields, listingStatus, pendingReviewChanges, preview) apps:read
PATCH /v1/developer/apps/{appId}/profile (partial; null clears) apps:write
PUT /v1/developer/apps/{appId}/listing { "listed": true } apps:write
GET /v1/apps?directory=seller|buyer|all, GET /v1/apps/{clientId} (public directory) any token

listingStatus is unlisted, pending_review, listed or rejected. Listing an app that was approved with the same name, scopes and audience is instant; anything else goes to review, and renaming a listed app or changing its scopes or audience sends it back. SDK: crossly.apps.getProfile, updateProfile, setListed, list, get.

Review for the gated scopes (apps:read / apps:write on your own token): GET /v1/developer/apps/{appId}/review; verification PUT /v1/developer/apps/{appId}/verification, POST .../verification/check-domain (DNS TXT crossly-app-verification=<token> on the domain or _crossly.<domain>), .../verification/submit; client certification PUT /v1/developer/apps/{appId}/certification, POST /v1/developer/apps/{appId}/conformance-runs, POST .../certification/submit. SDK: crossly.developerApps.putVerification, checkDomain, submitVerification, putCertification, startConformanceRun, getConformanceRun, submitCertification. Outcomes arrive as app.verification_decided / app.certification_decided webhooks.

9. Health and sandbox

GET /v1/developer/apps/{appId}/health (apps:read, own token; SDK crossly.developerApps.health(appId)): write-request counts by status class (24 h, 7 d), top error codes with advice, a retry-storm flag, the last 50 failed requests. Other sellers' messages are templated and never carry their correlation ids; reproduce with your own or a sandbox seller to see full detail.

Every app gets a sandbox twin (its own client id, secret and redirect URIs) and up to ten seeded sandbox sellers: see crossly-sandbox-testing.

Rules

  • Register with your own PAT; never ask a seller for theirs. Store the client secret and refresh tokens server-side only.
  • PKCE S256 + state on every authorization; openid and resource=https://crossly.net/api/v1 always.
  • Request the fewest scopes; never request a forbidden or first-party scope. Adding a scope later sends a listed app back to review.
  • Persist the rotated refresh token every refresh; refresh from one process only.
  • Treat 401 invalid_token as a disconnect and clean up; your webhooks for that seller are already gone.
  • Test end to end in the sandbox before listing.

Docs: https://crossly.net/docs/api-authentication · https://crossly.net/docs/api-scopes · https://crossly.net/docs/api-app-directory · https://crossly.net/docs/app-review · https://crossly.net/docs/api-app-managed-listings · https://crossly.net/docs/api-app-health · https://crossly.net/docs/api-app-sandbox