OAuth 2.0 lets an application obtain limited access to a protected API without asking the user to hand over their account password to that application. Testing an OAuth-protected API usually has two parts: obtain an access token through the provider’s approved flow, then send that token to the resource endpoint and verify its permissions. Keeping those parts separate makes failures easier to diagnose.
Test an OAuth access token with API TesterOAuth 2.0 roles and token flow
In OAuth terminology, the resource owner can authorize access to protected resources. The client is the application requesting permission. The authorization server authenticates or authorizes the client and issues tokens. The resource server hosts the API and checks the access token on protected requests. One organization may run both servers, but they have different jobs in the protocol.
- Step 1
Authorize
The client uses a grant appropriate to its application type.
- Step 2
Issue token
The authorization server returns a scoped access token.
- Step 3
Call API
The client sends the token to the resource server.
- Step 4
Check policy
The API enforces token validity and permissions.
OAuth versus JWT: protocol and token format
OAuth 2.0 is an authorization framework that describes how clients obtain and use access tokens. A JSON Web Token is a token format that can carry claims in a compact signed or encrypted representation. An OAuth server may issue a JWT access token, an opaque token, or another format supported by the system. Do not assume that every access token is a JWT or that decoding a JWT is the same as authorizing a request.
Obtain an access token through the right flow
For a user-facing application, Authorization Code with PKCE is a common modern flow. The client creates a high-entropy code verifier, derives a code challenge (commonly with SHA-256), and sends the challenge with the authorization request. After the user authorizes, the client exchanges the short-lived code plus the original verifier at the token endpoint. The authorization server checks that they match. The client should also use a fresh state value and an exact registered redirect URI. PKCE helps protect the authorization code from interception. Public clients should not embed a client secret because users can inspect code shipped to their browser or device.
For a service acting on its own behalf, Client Credentials may be appropriate when the authorization server and API are configured for machine-to-machine access. A confidential client authenticates to the token endpoint using the method agreed with the provider. Use only a test client and the minimum scope required. The exact token request parameters, authentication method, and response depend on the provider’s documentation. This flow normally does not issue a refresh token; follow the provider contract rather than assuming one is available.
Complete the authorization flow in the application or OAuth client designed for your identity provider. The JsonifyTools API Tester is an HTTP request client; it does not perform an interactive OAuth Authorization Code + PKCE flow, exchange an authorization code, or automatically refresh tokens. Once you have an access token from a trusted development flow, you can use it to test a resource endpoint.
{
"access_token": "ACCESS_TOKEN_FROM_TEST_AUTH_SERVER",
"token_type": "Bearer",
"expires_in": 900,
"scope": "notes:read notes:write",
"refresh_token": "RETURNED_ONLY_IF_THIS_CLIENT_IS_ALLOWED"
}Test an OAuth-protected API request
Send the access token to the resource server with the Bearer scheme. In API Tester, enter the documented API URL, select its HTTP method, open the Auth tab, choose Bearer Token, and paste the development access token. Add required query parameters, request headers, and a JSON body if that endpoint contract requires them.
curl -i https://api.example.test/v1/notes \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TEST_ACCESS_TOKEN"Start with a route the test identity should access. Then test a route or operation outside its allowed scope using a controlled account and safe data. Compare the status and response body, and inspect server-side audit logs if the response is ambiguous. Depending on the API contract, a missing or invalid access token may produce 401, while insufficient scope may produce 403; implementations can use other documented behavior. Never request permissions from a real user or access data that you are not authorized to test.
Test expiration, refresh, revocation, scopes, and permissions
Access tokens are limited by the authorization server’s policy and may expire, be revoked, or become invalid when a user or administrator changes access. Test an expired or revoked token through a development identity provider. Verify that the resource API rejects it and does not return protected data. For a refresh test, call the authorization server’s token endpoint according to the provider’s documented grant; the API Tester does not manage refresh-token rotation for you.
Check insufficient scopes by issuing a test token that intentionally lacks one permission, such as notes:write, then attempt the matching action against a non-production endpoint. A valid token can still be unauthorized for that operation. Check whether a revoked refresh token can be reused, and follow the provider’s rules for token rotation, replay detection, and session revocation.
Wrong audience
A token intended for one API should not be accepted by a different resource server.
Expired access token
Confirm the API rejects it and that the client uses the documented renewal flow.
Insufficient scope
Verify a read-only token cannot perform a write action.
Revoked refresh token
Confirm the authorization server refuses reuse according to its rotation policy.
OAuth API testing security checklist
- Use Authorization Code with PKCE for public clients where the provider requires it; use the flow documented for the client type.
- Request narrow scopes and use a dedicated development account.
- Keep confidential client credentials on a protected server, never in frontend code or an online tester.
- Use TLS for remote authorization and resource endpoints.
- Do not place access tokens in query strings, screenshots, tickets, or source control.
- Keep refresh tokens at the client that owns the OAuth session and handle rotation or revocation as documented.
- Validate audience, scopes, resource ownership, and role boundaries at the API.
For protocol details, read the OAuth 2.0 Authorization Framework (RFC 6749), the OAuth 2.0 Security Best Current Practice (RFC 9700), and the PKCE specification (RFC 7636). If the access token is a JWT, the JWT Decoder can show its visible claims for debugging, but it does not replace server-side signature and permission validation.
Continue your workflow
Related developer tools
Use these tools to build a request, inspect its data, and understand authentication responses.