Platform

Platform overview How it works Authorization testing Evidence & reports Private scanning Integrations

Solutions

Security agencies Product teams Regulated industries Partner programme

Learn

Blog Knowledge hub Compare

Resources

Pricing Documentation Help centre FAQ Security & data What we haven’t proved

Company

About Contact Careers Sign in to the platform Start a $199 pilot →

Home / Blog / Tutorials / Oauth client credentials

Tutorials

OAuth client credentials in Cyberlop: scan APIs with a minted token

OAuth 2.0 client credentials lets a scan mint its own access token from your token endpoint. This guide covers setup, safe clients, testing and fixes.

Cyberlop Labs · Updated · 9 min read

Illustration for OAuth client credentials in Cyberlop: scan APIs with a minted token
Quick answer

To scan with OAuth client credentials in Cyberlop, add a role to a scan profile, tick OAuth 2.0, enter the Token URL, Client ID, Client secret and optional Scope, keep or change the Authorization header and Bearer prefix, click Complete authentication to confirm a token is issued, then Preview YAML and Save.

Quick how-to
  1. Create a scanning client In your identity provider, create a dedicated client that may use the client credentials grant, with a narrow scope, on staging.
  2. Open the profile Go to Scan Profiles and click + New profile, or edit an existing profile with the pencil icon.
  3. Add a role Open the Authentication section, click + Add role, and enter a Name and the Privilege level that matches the client.
  4. Choose OAuth 2.0 Tick OAuth 2.0 under Authentication methods.
  5. Enter the client details Fill in Token URL, Client ID, Client secret and, if needed, Scope.
  6. Check the header Keep the default Header name Authorization and Header prefix Bearer, or change them to match your API.
  7. Complete authentication Click Complete authentication and confirm that a token is issued. Fix the fields if it is not.
  8. Add AI guidance Optionally add one step per line, such as re-minting the token if a request is rejected.
  9. Preview and save Click Preview YAML to validate the form, then Save.
  10. Run and verify Run a scan, then open the Sitemap tab and check that protected endpoints show the role.
Key takeaways
  • OAuth 2.0 client credentials lets Cyberlop mint a fresh token from your token endpoint at scan time and send it as a header.
  • Create a dedicated, least-privilege client for scanning, and point it at staging before production.
  • Complete authentication tests the exchange before you save, so a wrong URL, secret or scope shows up early.
  • Header name and prefix default to Authorization and Bearer; change them only if your API expects something else.
  • Stored secrets are never shown again: leave the secret blank when editing to keep it, and enter a new one to rotate it.

OAuth client credentials authentication in Cyberlop lets a scan fetch its own access token from your token endpoint and send it as a header, so it can test the parts of your app and API that sit behind OAuth 2.0. To set it up, open a scan profile, go to Authentication, add a role, tick OAuth 2.0, fill in the Token URL, Client ID and Client secret, then click Complete authentication and Save.

What is OAuth client credentials authentication in Cyberlop?

OAuth 2.0 client credentials is one of three methods an authentication role can use in Cyberlop. The in-app form describes it in one line: Cyberlop mints a token via client credentials and injects it as a header at scan time. You do not paste a token; you give the scan the credentials of a machine client and it asks for a token itself.

The grant comes from RFC 6749, the OAuth 2.0 Authorization Framework, section 4.4. Here the client acts for itself, not for a person, and gets a token for resources it controls. Nobody types a password and there is no redirect or consent screen, which is why the grant fits APIs, services and back-end jobs. Cyberlop uses it to get a short-lived access token for a role, using the OAuth flow your identity provider already runs.

A role is a named identity with one privilege level (Unauthenticated, User, Elevated or Admin). If roles are new to you, read Authentication roles first. Methods can be combined on one role, for example form plus header.

Four-step diagram: create a narrow client, add an OAuth 2.0 role, click Complete authentication, then save and scan.
Create a narrow client, add the OAuth 2.0 role, test the exchange, then save and scan.

When should you choose OAuth 2.0 over a header or form login?

Choose OAuth 2.0 when your API hands out tokens that expire and a machine client fetches them from a token endpoint. Choose a header for a fixed key that never changes, and form login when a person types a password into a page.

Method comparison

MethodBest forWhat you provideToken lifetime
Form loginWeb apps with a sign-in pageLogin URL, username, password, optional TOTP secret, success condition, login flow. See Form loginSession from the page
Header (token / API key)Fixed keys and pre-issued tokensHeader name and value pairs. See Header token authenticationWhatever you pasted
OAuth 2.0Services that issue tokens by client credentialsToken URL, Client ID, Client secret, scope, header name and prefixMinted at scan time

The practical gain is freshness. A scan of a small app typically takes roughly an hour, according to the in-app documentation. A pasted token with a short life can expire part-way through; a minted token cannot be stale when the scan starts.

What do you need from your identity provider first?

You need a dedicated client that is allowed to use the client credentials grant, its ID and secret, the token endpoint address, and a narrow scope. Create it before you open Cyberlop, and aim it at staging, not production.

Checklist: a safe scanning client

  • Dedicated. One client used only for scanning, so you can revoke it without breaking anything else.
  • Least privilege. RFC 9700, the OAuth 2.0 security best current practice, recommends keeping the privileges of an access token to the minimum the client needs. Apply the same least privilege thinking to the client.
  • Matching privilege level. Give the client the access that the Cyberlop role claims. An Admin role on a client that cannot reach admin routes will only produce 401 and 403 responses.
  • Short-lived tokens. A token that expires quickly is worth little to anyone who captures it.
  • Non-production. Use a staging app and a staging client. See Exploitation phase for what the proving step does to a live target.

The client is a service account in all but name, so treat it like one: owned by a team, listed in your access reviews, and removed when no longer needed.

How do you set up OAuth 2.0 client credentials in a scan profile?

Add an authentication role to a scan profile, tick OAuth 2.0, fill in six fields, test the exchange and save. The steps below follow the form exactly as it appears in the app.

  1. Go to Scan Profiles and click + New profile, or open the pencil icon on an existing profile. Pick the target and give the profile a Name. See Create a scan profile.
  2. Switch to the Authentication section and click + Add role.
  3. Enter a Name and choose the Privilege level that matches your client.
  4. Under Authentication methods, tick OAuth 2.0. Untick Form if the role should not use it (it is on by default).
  5. Fill in Token URL, Client ID and Client secret. Add a Scope if your provider needs one.
  6. Check Header name and Header prefix. Defaults are Authorization and Bearer .
  7. Click Complete authentication and wait for confirmation that a token was issued.
  8. Optionally add AI guidance, then click Preview YAML and Save.
New scan profile Authentication section with a role name, privilege level and the three method checkboxes.
A new role: name, privilege level and authentication methods. 1 Privilege level: Set the role's access level. 2 Authentication methods: Tick Form, Header or OAuth 2.0. 3 Login URL: Enter the app's sign-in page.. Sensitive details are blurred.
OAuth 2.0 block with token URL, client ID, scope, header name, prefix, Complete authentication button and AI guidance.
The OAuth 2.0 block: endpoint, client, header and the test button. 1 Token URL: Enter the OAuth 2.0 token endpoint. 2 Complete authentication: Test the OAuth setup once filled. 3 AI guidance: Optional steps, one per line.. Sensitive details are blurred.

OAuth 2.0 field reference

FieldWhat to enterNotes
Token URLThe address of your token endpoint, for example https://auth.example.com/oauth2/tokenMust be reachable from where the scan runs. RFC 6749 requires TLS on the token endpoint.
Client IDThe identifier of the scanning clientNot secret, but keep it with the client.
Client secretThe client's secretPassword field. Stored encrypted and never shown again.
ScopeSpace-separated scope values your provider expectsOptional. Leave blank if your provider issues a default scope.
Header nameThe header your API reads the token fromDefault Authorization.
Header prefixText placed before the tokenDefault Bearer , with a trailing space.
AI guidanceOne step per lineOptional. Tells the scan how to treat the token.

Header name and prefix

The default pair means the scan sends Authorization: Bearer <token>, which is the standard form for a bearer token. Change them only if your API reads the token from a different header, or expects a different scheme word. A wrong prefix is the most common reason a token is issued but every request is rejected.

Scope

RFC 6749 defines scope as a list of space-delimited, case-sensitive strings, and notes that the authorisation server may ignore part of what you request. Copy the values exactly, and check which scopes the issued token actually carries.

What does Complete authentication do?

Complete authentication runs the client credentials exchange from the form and confirms that a token is issued. The button's tooltip says exactly that: complete the OAuth2 client-credentials exchange and confirm a token is issued. It stays disabled until the required fields are filled.

Use it before you save. It tells you now, not an hour into a scan, that the Token URL, Client ID, Client secret and scope work together. If your account cannot run the test, ask an administrator whether your role holds the permission to manage profile credentials; the permissions guide explains how permission keys work.

What a good result and a bad result tell you

OutcomeWhat it meansWhat to do
Token issuedYour token endpoint accepted the client and returned an access tokenPreview YAML, Save and run a scan
No token issuedThe endpoint, client, secret or scope was refused or unreachableRe-check each field against your provider, then try again
Token issued, scan gets 401 or 403The token is valid but the header, prefix or scope is wrong for your APICheck Header name, Header prefix and the scope the token carries

A successful test proves the token can be minted. It does not prove the token can reach the routes you care about. For that, run a scan and read the scan sitemap, where each endpoint row carries a role chip and a note such as a gated 401.

What should the AI guidance say for an OAuth 2.0 role?

AI guidance is optional free text, one step per line, that tells the scan how to treat the credential. Keep it short and factual. The form's placeholder shows three lines:

  • Prefer the freshly minted OAuth 2.0 access token
  • If a request is rejected, re-mint rather than reusing an expired token
  • refresh_token / id_token can be used where an endpoint expects them

The third line needs care. RFC 6749 section 4.4.3 says a refresh token should not be included in a client credentials response, so many providers will not issue one. Add that line only if your provider genuinely returns those tokens. Add facts such as "this client can read orders but not billing" so the scan understands the role. Detail about your application belongs in Application context.

How do you keep the client secret safe and rotate it?

Treat the client secret as a long-lived credential and replace it on a schedule. Cyberlop stores secrets encrypted and never shows them again, and the form says to leave a field blank to keep the stored value.

Leaked secrets rarely get cleaned up. GitGuardian's State of Secrets Sprawl 2025 report counted 23,770,171 new hardcoded secrets added to public repositories in 2024. Of the secrets leaked in 2022, 70% still worked when the report was written, and generic credentials made up 58% of detected leaks. Private code is no safe harbour either: 35% of the private repositories its customers scanned held at least one plaintext secret.

Stat cards: 70% of secrets leaked in 2022 still valid; 58% of leaks are generic credentials; 35% of private repositories held a plaintext secret.
Findings from GitGuardian's State of Secrets Sprawl 2025 report. Source: GitGuardian: State of Secrets Sprawl 2025.

The OWASP Non-Human Identities Top 10 2025 lists Long-Lived Secrets (NHI7) and Overprivileged NHI (NHI5) as separate risks. A secret that never expires gives a thief access until someone notices, and a client with broad rights widens what that thief can reach. Your scanning client is a non-human identity, so keep it narrow and easy to replace. See secrets management and key rotation.

Rotation steps

  1. Create a new secret for the same client in your identity provider. Keep the old one active for now.
  2. Open the profile with the pencil icon and go to Authentication.
  3. Type the new value into Client secret. Leaving it blank would keep the old one.
  4. Click Complete authentication to confirm a token is issued.
  5. Click Preview YAML, then Save. See Edit a scan profile.
  6. Run a short scan to confirm, then revoke the old secret.
Edit profile Authentication section with an Admin role and a notice that stored credentials are kept when fields are blank.
Editing: stored secrets are never shown, blank keeps the value. 1 + Add role: Add another login role. 2 Authentication methods: Combine Form, Header or OAuth 2.0. 3 Credentials stored: Leave fields blank to keep them.. Sensitive details are blurred.

When someone leaves the team that owns the client, or a secret is pasted somewhere it should not be, rotate at once. RFC 9700 also recommends sender-constraining access tokens, for example with mutual TLS or DPoP, so a stolen token is useless without the client's key. That is a decision for your identity provider, not a field in this form.

Troubleshooting: why is OAuth 2.0 authentication not working?

Four causes account for most failures: a wrong address, a scope your provider does not recognise, a prefix mismatch, or a token endpoint the scan cannot reach.

Symptom, cause and fix

SymptomLikely causeFix
Complete authentication is greyed outRequired fields are emptyFill Token URL, Client ID and Client secret
No token is issuedWrong Token URL, wrong secret, or the client may not use client credentialsCopy the endpoint from your provider; confirm the grant is enabled for the client
No token, and the URL is correctScope not allowed for this clientRemove the scope or use one the client holds
Endpoint unreachableToken URL sits on a private networkAllow access from the scan location, or choose an internal agent. See Self-hosted scan agents
Token issued, everything returns 401Wrong header name or prefixMatch what your API expects, including the space after Bearer
Token issued, admin routes return 403Client lacks the privilege the role claimsAlign the client's permissions and the role's privilege level
Preview YAML shows an errorForm validation, for example an empty nameFix the field named in the red banner

Common mistakes

Using a production client

A scan sends a lot of requests. Start on staging with a client that cannot see real customer data, and move to production only after reading Exploitation phase and agreeing the rules of engagement.

Giving the client too much

A client with every permission lets the scan touch everything. Give it what the role needs, and add a second, weaker client only when you want to see what a lower-privilege caller can reach. See authenticated testing.

Forgetting the expiry

A minted token has a lifetime set by your provider. Add the re-mint line to AI guidance, and ask your provider for a token lifetime longer than the roughly one hour a small scan takes.

How do you check the scan used the token?

Open the finished scan and look at the Sitemap tab. Endpoints that need a token should show your role as a chip. If protected paths are missing, revisit the header and scope. See Run a scan for the five phases.

What is the next step after adding OAuth 2.0?

Next, set the report filters for the profile. Continue with Reporting rules to choose minimum severity and confidence, report guidance and rules of engagement. If a role needs a different method, see Header token authentication.

Questions people ask

Oauth client credentials: FAQs

What is OAuth client credentials?

It is the OAuth 2.0 grant in which a client requests an access token using only its own credentials, for resources under its control (RFC 6749, section 4.4). No person types a password. Cyberlop uses it to mint a token at scan time and send it as a header.

What header does Cyberlop send the token in?

By default the Header name is Authorization and the Header prefix is Bearer with a trailing space. Change both if your API reads the token elsewhere.

What does Complete authentication do?

It runs the client-credentials exchange and confirms that a token is issued. It is disabled until the fields are filled. Use it before saving so errors show immediately.

Do I need to enter a scope?

Only if your identity provider requires one. The field is optional. Use the exact space-separated values your provider documents, because scope values are case-sensitive in RFC 6749.

Can a role use OAuth 2.0 and another method together?

Yes. The form says to combine methods to authenticate a role, for example form plus header. Tick each method and fill its block. Keep guidance for each method separate.

Is the client secret stored safely, and can I see it again?

Secrets are stored encrypted and are never shown again. When you edit a profile, leave the field blank to keep the stored value, or type a new secret to replace it.

How do I rotate the client secret?

Create a new secret at your provider, enter it in Client secret, click Complete authentication, then Preview YAML and Save. Run a scan, then revoke the old secret.

Should I scan production with a client credentials token?

Start with staging and a narrow client. The exploitation phase actively tests the live target, so agree rules of engagement and read the exploitation guide before any production scan. Only scan apps you own or are authorised to test.

Cyberlop mark

Need help setting up scan credentials?

Cyberlop finds vulnerabilities in web apps and their APIs with black-box, grey-box and white-box pentesting, and reports only what it exploited. Ask us to run it on one of your applications.

Or start with a $199 pilot on one application: thirty days, success criteria agreed before day one, credited against the annual if you convert.