<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
Update an Access Policy Rule on an Authorization Server to Trigger an Inline Token Hook
API Access Management
Okta Classic Engine
Okta Identity Engine
Overview

How to make an API request to modify an Authorization Server's access policies and rules to trigger a Token Inline Hook.

Solution

Pre-Requisites

 

Making the update

  1. Get the current configuration for the Access Rule that is being updated. 

GET https://oktaDomain/api/v1/authorizationServers/{{authorizationServerId}}/policies/{{accessPolicyId}}/rules/{{accessRuleId}}

    • Example response:
      {
          "id": "0pr1234567890",
          "status": "ACTIVE",
          "name": "Token Hook",
          "priority": 2,
          "created": null,
          "lastUpdated": null,
          "system": false,
          "conditions": {
              "people": {
                  "users": {
                      "include": [],
                      "exclude": []
                  },
                  "groups": {
                      "include": [
                          "EVERYONE"
                      ],
                      "exclude": []
                  }
              },
              "grantTypes": {
                  "include": [
                      "implicit",
                      "urn:ietf:params:oauth:grant-type:saml2-bearer",
                      "client_credentials",
                      "password",
                      "urn:ietf:params:oauth:grant-type:device_code",
                      "authorization_code",
                      "urn:ietf:params:oauth:grant-type:token-exchange"
                  ]
              },
              "scopes": {
                  "include": [
                      "*"
                  ]
              }
          },
          "actions": {
              "token": {
                  "accessTokenLifetimeMinutes": 60,
                  "refreshTokenLifetimeMinutes": 0,
                  "refreshTokenWindowMinutes": 10080
              }
          },
          "type": "RESOURCE_ACCESS"
      }
  1. Format the request body for the update
    • Modify the `actions` object returned above to add the inlineHook.id:
      "actions": {
          "token": {
              "accessTokenLifetimeMinutes": 60,
              "refreshTokenLifetimeMinutes": 0,
              "refreshTokenWindowMinutes": 10080,
              "inlineHook": {
                  "id": "<<inline hook id>>"
              }
          }
      }
  2. Make the update request, PUT https://oktaDomain/api/v1/authorizationServers/{{authorizationServerId}}/policies/{{accessPolicyId}}/rules/{{accessRuleId}}
    {
        "id": "0pr123456789",
        "status": "ACTIVE",
        "name": "Token Hook",
        "priority": 2,
        "created": null,
        "lastUpdated": null,
        "system": false,
        "conditions": {
            "people": {
                "users": {
                    "include": [],
                    "exclude": []
                },
                "groups": {
                    "include": [
                        "EVERYONE"
                    ],
                    "exclude": []
                }
            },
            "grantTypes": {
                "include": [
                    "implicit",
                    "urn:ietf:params:oauth:grant-type:saml2-bearer",
                    "client_credentials",
                    "password",
                    "urn:ietf:params:oauth:grant-type:device_code",
                    "authorization_code",
                    "urn:ietf:params:oauth:grant-type:token-exchange"
                ]
            },
            "scopes": {
                "include": [
                    "*"
                ]
            }
        },
        "actions": {
            "token": {
                "accessTokenLifetimeMinutes": 60,
                "refreshTokenLifetimeMinutes": 0,
                "refreshTokenWindowMinutes": 10080,
                "inlineHook": {
                        "id": "cal1234567890"
                    }
            }
        },
        "type": "RESOURCE_ACCESS"
    }
Loading
Update an Access Policy Rule on an Authorization Server to Trigger an Inline Token Hook