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

Start the authorization code flow and issue a code

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

Start the authorization code flow and issue a code (auto-approved as user apibee).

Codes are single use and expire after 10 minutes. Exchange them at POST /api/auth/oauth/token.Codes are single use and expire after 10 minutes. Exchange them at POST ….

Note: PKCE: code_challenge = base64url(SHA-256(code_verifier)). Registered redirect URIs (localhost, 127.0.0.1, Postman, this server's Swagger) get a 302. Any other redirect_uri is refused with 400 invalid_request and no code is issued. Leave redirect_uri out to get the code as JSON.

Parameters 7

NameTypeDescription
response_typequery · stringMust be code.
client_idquery · stringapibee-client (confidential) or apibee-public (public; PKCE required).
redirect_uriquery · stringWhere to send the code. Registered: http(s) URIs on localhost or 127.0.0.1 (any port) and the Postman callbacks. Any other value is refused with 400 and no code is issued; leave it out to get the code as JSON.
scopequery · stringSpace-separated subset of the client's scopes (apibee-client: read write profile email; apibee-public: read profile email). Defaults to all of them.
statequery · stringOpaque value echoed back unchanged.
code_challengequery · stringPKCE challenge: BASE64URL(SHA256(code_verifier)) for S256, or the verifier itself for plain.
code_challenge_methodquery · stringS256 or plain (default plain).

Responses

200
Code returned as JSON (no redirect_uri sent).
302
Redirect to redirect_uri with code and state.
400
invalid_client, unsupported_response_type, invalid_request (including an unregistered redirect_uri) or invalid_scope.

Example

Request
curl -X GET "https://api.testingapis.com/api/auth/oauth/authorize?response_type=code&client_id=apibee-public&redirect_uri=http://localhost:3000/callback&state=xyz&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256" \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response302 Found
Location: http://localhost:3000/callback?code=code_3d7eac7eaf6981c2de11965a88d969531cf9a9c3&state=xyz

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.