PUBLIC API · v1
DOCUMENTATION

Delegation · PKCE

Access on behalf of a user with their explicit consent.

API https://api.reduxhub.ru/public/v1

DL https://dl.reduxhub.ru

Reference only · no requests

Authorization Code + S256#

  • Generate random state and a 43–128-character code_verifier; retain only for the attempt. challenge = unpadded BASE64URL(SHA256(verifier)).
  • Open /developers/authorize on the matching website, not the docs or API host. Query: client_id, redirect_uri, space-separated scope, state, code_challenge, code_challenge_method=S256. Register the client and exact redirect URI first.
  • The consent page shows the server-validated app, URI and scopes; only an explicit click approves access. Validate callback state first. The one-time code lasts 120 seconds.
  • Exchange the code through POST /oauth/token with grant_type=authorization_code, numeric client_id, code, redirect_uri and code_verifier. Both application/json and application/x-www-form-urlencoded are accepted.
  • The rh_user_ token lasts 3600 seconds. No silent refresh or implicit consent. Every upload/edit/download rechecks the grant, account, project, current permissions, consent and ownership.

Generate the challenge on your server#

JavaScript · Node.js
import { randomBytes, createHash } from "node:crypto";
const verifier = randomBytes(32).toString("base64url");
const state = randomBytes(24).toString("base64url");
const challenge = createHash("sha256").update(verifier).digest("base64url");
// Keep verifier + state in the server-side authorization attempt.
// Pass challenge and state to /developers/authorize, then validate callback state.

Exchange the authorization code#

After user consent send the issued code, original verifier and exact registered redirect_uri. The variables below belong to your current authorization attempt.

cURL
curl --fail-with-body --max-time 15 \
  -X POST "http://127.0.0.1:1335/public/v1/oauth/token" \
  --data-urlencode "grant_type=authorization_code" \
  --data-urlencode "client_id=$OAUTH_CLIENT_ID" \
  --data-urlencode "code=$OAUTH_CODE" \
  --data-urlencode "redirect_uri=$OAUTH_REDIRECT_URI" \
  --data-urlencode "code_verifier=$OAUTH_VERIFIER"

OAuth responses#

Captured responses from the local application. Only access_token, the secret rh_user_ token, is redacted in the successful response. OAuth returns JSON without the success/data/meta wrapper. Never persist the token in browser storage.

POST /public/v1/oauth/token

HTTP response
HTTP/1.1 200
x-request-id: 0f59bd1c-7dd7-4f88-8fab-4676e5b1068e
cache-control: no-store
pragma: no-cache
content-type: application/json; charset=utf-8

{
  "access_token": "[REDACTED: generated user token]",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "downloads:create"
}

POST /public/v1/oauth/token

HTTP response
HTTP/1.1 400
x-request-id: f1e15906-6833-4a18-9b82-6a395e97ba09
cache-control: no-store
pragma: no-cache
content-type: application/json; charset=utf-8

{
  "error": "invalid_grant",
  "error_description": "Token request rejected"
}

ReduxHub Developers · API 1.0.0