On this page
GET /.well-known/* · POST /oauth/register.php · GET /oauth/authorize.php · POST /oauth/token.php
Compare the authorization and resource metadata
Read the authorization-server document for endpoints, PKCE and the two supported scopes. Match the resource metadata to the MCP URL. The reporting resource advertises reports:read. The transactions resource advertises api. Tokens are bound to their requested resource and scope.
GET /.well-known/oauth-authorization-server
curl -4 -sS -i "${SIMCLOUD_API_BASE:-https://simcloud.co.za}/.well-known/oauth-authorization-server"
GET /.well-known/oauth-protected-resource
curl -4 -sS -i "${SIMCLOUD_API_BASE:-https://simcloud.co.za}/.well-known/oauth-protected-resource"
HTTP 200 response excerpt
{
"scopes_supported": [
"api"
]
}
GET /.well-known/oauth-protected-resource/api/reporting-mcp.php
curl -4 -sS -i "${SIMCLOUD_API_BASE:-https://simcloud.co.za}/.well-known/oauth-protected-resource/api/reporting-mcp.php"
HTTP 200 response excerpt
{
"scopes_supported": [
"reports:read"
]
}
Register a desktop client
Provide a supported callback you control. This example uses a local desktop callback and requests reports:read. HTTP 201 returns the client_id. Set SIMCLOUD_OAUTH_CLIENT_ID and SIMCLOUD_OAUTH_REDIRECT_URI to your client and callback. Use the published callback rules for other clients.
POST /oauth/register.php
curl -4 -sS -i -X POST "${SIMCLOUD_API_BASE:-https://simcloud.co.za}/oauth/register.php" \
-H 'Content-Type: application/json' \
--data '{
"client_name": "Example SIMcloud reporting client",
"redirect_uris": [
"http://127.0.0.1:43210/callback"
],
"scope": "reports:read",
"token_endpoint_auth_method": "none"
}'
HTTP 201 response excerpt
{
"scope": "reports:read",
"token_endpoint_auth_method": "none"
}
Open the authorization request in the user’s browser
Generate a fresh high-entropy state and PKCE verifier. Set SIMCLOUD_PKCE_CHALLENGE to the unpadded base64url SHA-256 digest of the verifier. Set SIMCLOUD_OAUTH_RESOURCE to the full reporting endpoint URL, including /api/reporting-mcp.php. Use the request below to construct the browser URL. Sign in and approve only the required permission. Validate state and issuer on the return before setting SIMCLOUD_OAUTH_CODE to the returned code.
The curl command shows the initial request. The browser handles the SIMcloud login and consent screen. Keep the verifier, code and refresh token private.
GET /oauth/authorize.php
curl -4 -sS -i "${SIMCLOUD_API_BASE:-https://simcloud.co.za}/oauth/authorize.php" \
--get \
--data-urlencode 'response_type=code' \
--data-urlencode "client_id=$SIMCLOUD_OAUTH_CLIENT_ID" \
--data-urlencode "redirect_uri=$SIMCLOUD_OAUTH_REDIRECT_URI" \
--data-urlencode "resource=$SIMCLOUD_OAUTH_RESOURCE" \
--data-urlencode 'scope=reports:read' \
--data-urlencode "state=$SIMCLOUD_OAUTH_STATE" \
--data-urlencode "code_challenge=$SIMCLOUD_PKCE_CHALLENGE" \
--data-urlencode 'code_challenge_method=S256'
Exchange the code for a resource-bound token
Send the authorization code, the same client, callback and resource, and the original verifier in a form-encoded POST. The response includes access_token, refresh_token, token_type, scope and expires_in. Use the reporting access token for requests to that resource.
POST /oauth/token.php
curl -4 -sS -i -X POST "${SIMCLOUD_API_BASE:-https://simcloud.co.za}/oauth/token.php" \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode "client_id=$SIMCLOUD_OAUTH_CLIENT_ID" \
--data-urlencode "code=$SIMCLOUD_OAUTH_CODE" \
--data-urlencode "redirect_uri=$SIMCLOUD_OAUTH_REDIRECT_URI" \
--data-urlencode "resource=$SIMCLOUD_OAUTH_RESOURCE" \
--data-urlencode "code_verifier=$SIMCLOUD_PKCE_VERIFIER"
HTTP 200 response excerpt
{
"token_type": "Bearer",
"scope": "reports:read"
}
Refresh an access token
Use the current refresh token with the same client and resource. Save the newly returned tokens securely. If the connection was revoked, restart browser consent rather than trying to reuse its refresh token.
POST /oauth/token.php
curl -4 -sS -i -X POST "${SIMCLOUD_API_BASE:-https://simcloud.co.za}/oauth/token.php" \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode "client_id=$SIMCLOUD_OAUTH_CLIENT_ID" \
--data-urlencode "resource=$SIMCLOUD_OAUTH_RESOURCE" \
--data-urlencode "refresh_token=$SIMCLOUD_OAUTH_REFRESH_TOKEN"
HTTP 200 response excerpt
{
"token_type": "Bearer",
"scope": "reports:read"
}
Remove a connection
Open Connected Apps using the link from the published MCP setup guide, sign in to the owning account and select Revoke access next to the app. It is a signed-in browser action. Existing orders keep their status.