---
title: OAuth 2.0 scopes policy script API functionality
description: In addition to the functionality provided by Access HTTP services and Debug logging, OAuth 2.0 policy condition scripts can access some environment properties relating to the authorization request.
component: pingam
version: 7.3
page_id: pingam:authorization-guide:scripting-api-oauth2-policy
canonical_url: https://docs.pingidentity.com/pingam/7.5/am-authorization/scripting-api-oauth2-policy.html
llms_txt: https://docs.pingidentity.com/pingam/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
keywords: ["Authorization", "Policy", "OAuth 2.0", "Scope"]
---

# OAuth 2.0 scopes policy script API functionality

In addition to the functionality provided by [Access HTTP services](../scripting-guide/scripting-api-global-http-client.html) and [Debug logging](../scripting-guide/scripting-api-global-logger.html), OAuth 2.0 policy condition scripts can access some environment properties relating to the authorization request.

This information can then be returned as needed in the response to an authorization request:

**Authorization state objects**

| Object        | Type                       | Description                                                                                                                                                                                                                                |
| ------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `authorized`  | `Boolean`                  | Return `true` if the authorization is currently successful, or `false` if authorization has failed. Server-side scripts must set a value for `authorized` before completing.                                                               |
| `environment` | `Map<String, Set<String>>` | Describe the environment passed from the client making the authorization request.For example, the following shows an `environment` map with a single entry:```none
"environment": {
    "clientId": [
        "MyOAuth2Client"
    ]
}
``` |

The following JavaScript writes the ID of the OAuth 2.0 client to the debug log, and then authorizes the request:

```javascript
logger.message("Client ID: " + environment.get("clientId"));
authorized=true;
```
