Overview
What is its Purpose?
- Standardizes authentication in OAuth 2-based access to enterprise services, providing centralized control at the API Proxy (API Gateway) level.
- Manages different grant type needs under a single policy, providing project-based consistency.
- Controls access duration, refresh rights, and security boundaries by managing token and refresh token lifecycles according to organizational policies.
- Integrates identity and role sources with Secret Manager, API, LDAP, or database providers, making authorization processes compatible.
Working Principle
- Request Arrival: For each HTTP/HTTPS request arriving at the API Gateway, the source IP address of the request is detected.
- Policy Check: If the OAuth 2 Authentication policy is active, the system checks in the following order:
- Is a Condition defined? If so, is the condition met?
- Is the policy active (active=true)?
- Is a Variable used or is Apinizer default?
- OAuth 2 Flow Control: Verifies client credentials according to the selected grant type, retrieves identity or role data from Identity Role Group and Secret Manager information if necessary, and applies token generation/refresh rules.
- Decision Making:
- Match Found: An access token is created for the authorized client or the existing token is validated, and header enrichments are applied.
- No Match: Token generation or validation is rejected, and unauthorized access is logged.
- Error Handling: Returns customizable HTTP status code and error message for requests that do not comply with the policy rule.
Features and Capabilities
Basic Features
- Grant Type Management: Provides authentication suitable for different client types by supporting CLIENT_CREDENTIALS and PASSWORD flows.
- Token Lifecycle Control: Defines access token duration, refresh token rights, and refresh count according to project requirements.
- Identity Provider Integration: Provides authentication flexibility by working with Secret Manager, Identity Role Group, LDAP, API, or database-based identity sources.
- Active/Passive Status Control: Easily change the active or passive status of the policy (active/passive toggle). In passive state, the policy is not applied but its configuration is preserved.
- Conditional Application: Determine when the policy will be applied by creating complex conditions with Query Builder (e.g., only for specific endpoints or header values).
Advanced Features
- Secret Manager-Based Assurance: Provides additional security and IP address tracking for passwordless flows by keeping credentials in a secure vault.
- Header Enrichment: Writes the authenticated user’s identity and role information to customizable header fields.
- Method-Based Authorization: Defines special role sets for API methods and applies granular access control.
- Export/Import Feature: Export policy configuration as a ZIP file. Import to different environments (Development, Test, Production). Version control and backup capability.
- Policy Group and Proxy Group Support: Manage multiple policies within Policy Group. Bulk policy assignment to Proxy Groups. Centralized update and deploy operations.
- Deploy and Versioning: Deploy policy changes to live environment. See which API Proxies use it (Policy Usage). Proxy Group and Policy Group usage reports.
Usage Scenarios
Configuring Policy Parameters
In this step, users can create a new policy or configure existing policy parameters to define access rules. The defined parameters directly affect how the policy works (e.g., which IPs will be allowed, geographical restrictions, conditional activations, etc.). This way, the policy can be customized according to organization-specific requirements and managed centrally.Creating New OAuth 2 Authentication Policy

Configuration Steps
For the description of Conditions and Error Message Customization panels, you can review the Conditions and Error Message Customization (Error Message Customization) sections on the What is Policy? page.
For a complete guide on all layers, priority order and scenario examples of the error message configuration system, see the Error Message Configuration Guide page.
Deleting Policy
For the deletion steps of this policy and operations to be applied while in use, you can refer to the Removing Policy from Flow section on the Policy Management page.Exporting/Importing Policy
For the export and import steps of this policy, you can refer to the Export/Import page.Binding Policy to API
For the process of how this policy will be bound to APIs, you can refer to the Binding Policy to API section on the Policy Management page.Advanced Features
Best Practices
Things to Do and Best Practices
Security Best Practices
Things to Avoid
Performance Tips
Client Authentication — Authorization Basic Header Support (RFC 6749 §2.3.1)
Sending Credentials via Basic Authorization Header
Your client credentials (client_id and client_secret) can now be transmitted using HTTP Basic Authentication, following RFC 6749 standard compliance:
Backward-Compatible Body Parameters
The legacy method of sending credentials in the request body remains fully supported:Important Rules
- Mutual exclusivity: If you send both the Authorization Basic header AND
client_id/client_secretin the request body, the server rejects the request withinvalid_request(HTTP 400) per RFC 6749 §2.3.1 “MUST NOT”. - Malformed headers: Invalid Base64 encoding or missing colon (
:) in the decoded credentials are rejected withinvalid_client(HTTP 401). - Non-Basic schemes: Authorization headers with schemes other than Basic (e.g.,
Bearer) are ignored; the server falls back to body parameters. - Resource owner password flow:
usernameandpassword(PASSWORD grant type) must always be sent in the request body; the Authorization Basic header is reserved for client credentials only.

