Exchange an authorized request token for an access token
Exchange an authorized request token for an access token (step 3 of the three-legged flow).
Sign with apibee-consumer-key / apibee-consumer-secret plus the request token from POST /api/auth/oauth1/request_token and its secret, and include oauth_verifier from GET /api/auth/oauth1/authorize. In Postman, put the request token and secret in Access Token and Token Secret, and the verifier in Verifier.Sign with apibee-consumer-key / apibee-consumer-secret plus the request token from POST … and its secret, and include oauth_verifier from GET …. In Postman, put the request token and secret in Access Token and Token Secret, and the verifier in Verifier.
Response: application/x-www-form-urlencoded by default, or JSON when the request sends Accept: application/json. The access token works on /api/auth/oauth1 for 1 hour. Each request token can be exchanged only once.Response: application/x-www-form-urlencoded by default, or JSON when the request sends Accept: application/json. The access token works on … for 1 hour. Each request token can be exchanged only once.
OAuth 1.0a signature with the consumer credentials plus the request token and its secret
Parameters 9
| Name | Type | Description |
|---|---|---|
oauth_consumer_keyrequired | header · string | apibee-consumer-key. In the Authorization: OAuth header, the query string or a form body (one place only). |
oauth_tokenrequired | header · string | The request token from POST /api/auth/oauth1/request_token.The request token from POST …. |
oauth_verifierrequired | header · string | The verifier from GET /api/auth/oauth1/authorize.The verifier from GET …. |
oauth_signature_methodrequired | header · string | HMAC-SHA1, HMAC-SHA256, HMAC-SHA512 or PLAINTEXT. |
oauth_signaturerequired | header · string | Signed with the request token's secret: the signing key is consumer_secret&request_token_secret. For PLAINTEXT, send that key percent-encoded (& becomes %26). |
oauth_timestamp | header · string | Unix time in seconds, within 5 minutes of server time. Required for the HMAC methods; may be left out for PLAINTEXT. |
oauth_nonce | header · string | A random string; each one works once. Required for the HMAC methods; may be left out for PLAINTEXT. |
oauth_version | header · string | Optional. If sent, it must be 1.0. |
Accept | header · string | application/json for a JSON response. Without it the response is application/x-www-form-urlencoded. |
Responses
- 200
- oauth_token, oauth_token_secret, username and oauth_expires_in (3600).
- 400
- parameter_absent: oauth_token or oauth_verifier is missing. Or another protocol parameter problem.
- 401
- permission_unknown (not authorized yet), parameter_rejected (wrong verifier), token_used, token_expired, token_rejected, or a signature problem.
Example
curl -X POST "https://api.testingapis.com/api/auth/oauth1/access_token" \
-H "Accept: application/json" \
-H 'Authorization: OAuth oauth_consumer_key="apibee-consumer-key", oauth_token="{{oauth1RequestToken}}", oauth_verifier="{{oauth1Verifier}}", oauth_signature_method="PLAINTEXT", oauth_signature="apibee-consumer-secret%26{{oauth1RequestSecret}}"' \
-H "X-TestingApis-Key: YOUR_API_KEY"{
"oauth_token": "o1at_beca6b87b958050a30c6e3a3964c430afaaa2c32",
"oauth_token_secret": "o1as_4323dfe2ab31282bd2b69f07bee972b14a71ffd8",
"username": "apibee",
"oauth_expires_in": "3600"
}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.