TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Call a protected resource with an OAuth 1.0a signed request

GEThttps://api.testingapis.com/api/auth/oauth1Sign in to see this endpoint's URL

Accepts the static token apibee-access-token / apibee-token-secret (never expires; user apibee), a token issued by POST /api/auth/oauth1/access_token, or no token at all for a two-legged (consumer-only) request. A request token is rejected: exchange it first. Query parameters are covered by the signature.Accepts the static token apibee-access-token / apibee-token-secret (never expires; user apibee), a token issued by POST …, or no token at all for a two-legged (consumer-only) request. A request token is rejected: exchange it first. Query parameters are covered by the signature.

Signing key: percentEncode(consumer_secret) + "&" + percentEncode(token_secret), with an empty token secret when there is no token. Signature methods: HMAC-SHA1, HMAC-SHA256, HMAC-SHA512 and PLAINTEXT; RSA-SHA1 is not supported. The rules for every signed request, and what each oauth_problem means, are under Signing rules on the OAuth 1.0a page.

Note: legs is "two-legged" and user is null when no token is sent. tokenExpiresIn is the seconds left for an issued token and null for the static token. signatureBaseString is the string the server signed (null for PLAINTEXT); on a signature mismatch the 401 carries it in details.signatureBaseString, so you can diff it against yours.

OAuth 1.0a signature: consumer apibee-consumer-key / apibee-consumer-secret, plus token apibee-access-token / apibee-token-secret, one from POST /api/auth/oauth1/access_token, or no token (two-legged)OAuth 1.0a signature: consumer apibee-consumer-key / apibee-consumer-secret, plus token apibee-access-token / apibee-token-secret, one from POST …, or no token (two-legged)

Parameters 7

NameTypeDescription
oauth_consumer_keyrequiredheader · stringapibee-consumer-key. In the Authorization: OAuth header, the query string or a form body (one place only).
oauth_tokenheader · stringapibee-access-token, an access token from POST /api/auth/oauth1/access_token, or left out for a two-legged request.apibee-access-token, an access token from POST …, or left out for a two-legged request.
oauth_signature_methodrequiredheader · stringHMAC-SHA1, HMAC-SHA256, HMAC-SHA512 or PLAINTEXT.
oauth_signaturerequiredheader · stringBase64 HMAC of the signature base string, or for PLAINTEXT the signing key itself: consumer_secret&token_secret, percent-encoded (& becomes %26).
oauth_timestampheader · stringUnix time in seconds, within 5 minutes of server time. Required for the HMAC methods; may be left out for PLAINTEXT.
oauth_nonceheader · stringA random string; each one works once. Required for the HMAC methods; may be left out for PLAINTEXT.
oauth_versionheader · stringOptional. If sent, it must be 1.0.

Responses

200
Signature valid. Returns the legs, signature method, where the OAuth parameters were found, the consumer key, token and user.
400
parameter_absent (a required OAuth parameter is missing), parameter_rejected (a parameter is duplicated or OAuth parameters are in more than one place), version_rejected or signature_method_rejected.
401
consumer_key_unknown, token_rejected, token_expired, timestamp_refused, nonce_used or signature_invalid. Carries WWW-Authenticate: OAuth realm="apibee", oauth_problem="...".

Example

Request
curl -X GET "https://api.testingapis.com/api/auth/oauth1" \
  -H 'Authorization: OAuth oauth_consumer_key="apibee-consumer-key", oauth_token="apibee-access-token", oauth_signature_method="PLAINTEXT", oauth_signature="apibee-consumer-secret%26apibee-token-secret"' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
{
  "authenticated": true,
  "scheme": "oauth1",
  "legs": "three-legged",
  "signatureMethod": "PLAINTEXT",
  "parametersIn": "Authorization header",
  "consumerKey": "apibee-consumer-key",
  "token": "apibee-access-token",
  "tokenExpiresIn": null,
  "user": {
    "username": "apibee",
    "name": "TestingAPIs Tester",
    "email": "tester@example.com"
  },
  "timestamp": null,
  "nonce": null,
  "signatureBaseString": null
}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.