New in 2.4: Test runs you can trust See what's new →

Authorize a request token and issue a verifier

GEThttps://api.testingapis.com/api/auth/oauth1/authorize

Authorize a request token and issue a verifier (step 2, auto-approved as user apibee).

Not signed: this is the page a user would open in a browser. When the request token's oauth_callback is an http(s) URL on localhost or 127.0.0.1 (any port) or a Postman callback, it redirects there with oauth_token and oauth_verifier. For oob or any other callback, the verifier is returned as JSON.

Next: POST /api/auth/oauth1/access_token, signed with the request token and its secret, plus oauth_verifier.

Parameters 1

NameTypeDescription
oauth_tokenrequiredquery · stringThe request token from POST /api/auth/oauth1/request_token.

Responses

200
Verifier returned as JSON: oob, or a callback that isn't allowlisted.
302
Redirect to the callback with oauth_token and oauth_verifier.
400
parameter_absent (no oauth_token), token_rejected (unknown token), token_expired, or token_used (already exchanged).

Example

Request
curl -X GET "https://api.testingapis.com/api/auth/oauth1/authorize?oauth_token={{oauth1RequestToken}}"
Run in Studio
Response200 OK
{
  "oauth_token": "o1rt_6112c483e357a56ceb9ea6d5fc7bc9e31e89b4ae",
  "oauth_verifier": "o1v_21e0cb4ef8eae05c096e290e61fc38b236921b52",
  "user": "apibee",
  "callback": "oob",
  "message": "Authorized (out of band). Exchange the request token at POST /api/auth/oauth1/access_token with this oauth_verifier."
}

Code examples

JavaScript (fetch)
const response = await fetch("https://api.testingapis.com/api/auth/oauth1/authorize?oauth_token={{oauth1RequestToken}}");
console.log(response.status, await response.text());
Python (requests)
import requests

response = requests.request(
    "GET",
    "https://api.testingapis.com/api/auth/oauth1/authorize?oauth_token={{oauth1RequestToken}}",
    allow_redirects=False,
)
print(response.status_code, response.text)
Java (HttpClient)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newBuilder()
            .followRedirects(HttpClient.Redirect.NEVER)
            .build();

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.testingapis.com/api/auth/oauth1/authorize?oauth_token={{oauth1RequestToken}}"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode() + " " + response.body());
    }
}