Partners
Connect with Yudoo
For platforms and developers who want merchants to connect their Yudoo store with one click, without copying keys. It works like "Sign in with…": you open a Yudoo pop-up, the merchant approves, and you get an API key for the store they picked.
Register your app in Yudoo › Settings › API keys › Your partner apps: a name and your exact redirect URIs (https). You get a
client_id(yc_…) and aclient_secret(ycs_…, shown once).Open the connect page in a pop-up (or a full page) with your
client_id, one registeredredirect_uri, the scopes you need and a random state.The merchant signs in to Yudoo, picks a store, sees your app's name and what it asks for, and presses Approve.
Yudoo sends the browser back to
redirect_uri?code=…&state=…. Check that state is the one you sent. If the merchant cancels you get ?error=access_denied&state=….Within 10 minutes, from your server, trade the code for the store's API key at
POST /connect/token. A code works once.
GET https://app.yudoo.io/connect/authorize
?response_type=code
&client_id=yc_your_client_id
&redirect_uri=https%3A%2F%2Fpartner.example.com%2Fyudoo%2Fcallback
&scope=store%3Aread%20orders%3Aread
&state=8f3c1e9a2b const state = crypto.randomUUID();
sessionStorage.setItem("yudoo_state", state);
const url = new URL("https://app.yudoo.io/connect/authorize");
url.search = new URLSearchParams({
response_type: "code",
client_id: "yc_your_client_id",
redirect_uri: "https://partner.example.com/yudoo/callback",
scope: "store:read orders:read",
state,
}).toString();
window.open(url, "yudoo-connect", "width=480,height=720");
// On /yudoo/callback: check state, send the code to your server,
// then window.opener.postMessage({ connected: true }, location.origin) and window.close(). POST/api/v1/connect/token
curl -X POST https://app.yudoo.io/api/v1/connect/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "authorization_code",
"client_id": "yc_your_client_id",
"client_secret": "'"$YUDOO_CLIENT_SECRET"'",
"code": "the_code_from_the_redirect",
"redirect_uri": "https://partner.example.com/yudoo/callback"
}'const res = await fetch("https://app.yudoo.io/api/v1/connect/token", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
grant_type: "authorization_code",
client_id: process.env.YUDOO_CLIENT_ID,
client_secret: process.env.YUDOO_CLIENT_SECRET,
code, // from the redirect
redirect_uri: "https://partner.example.com/yudoo/callback",
}),
});
const { api_key, scopes, store } = await res.json();
// Save api_key for this merchant (encrypted). Use it as Authorization: Bearer <api_key>. The answer:
{
"api_key": "wp_live_…",
"token_type": "Bearer",
"scopes": ["store:read", "orders:read"],
"store": { "id": "cm…", "name": "Nile Store", "url": "https://nilestore.example" }
} | Error | When |
|---|---|
invalid_client (401) | The client_id or client_secret is wrong. |
invalid_grant (400) | The code is wrong, older than 10 minutes, already used, or redirect_uri differs from the one used to open the page. |
unsupported_grant_type (400) | grant_type is not authorization_code. |
error=invalid_scope (redirect) | scope has a word that is not store:read, orders:read or orders:write. |
error=access_denied (redirect) | The merchant pressed Cancel. |
- The key you get is shown to the merchant in Settings › API keys as a connected app, with your app's name. The merchant can revoke it any time; your requests then answer 401.
- A wrong
client_idor aredirect_uriyou did not register shows an error page; Yudoo never redirects to it. - The connect page cannot be put in an iframe: open it as a pop-up or a full page.
- Keep
client_secretand the keys on your server. Use a fresh, random state for every attempt.
Stuck, or need a field we don't have yet? Our team answers on WhatsApp.