> ## Documentation Index
> Fetch the complete documentation index at: https://help.lobyco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Postman collection

> Postman collection for exercising chain and store level access.

## Azure AD Custom Claims assignment to users

This Postman collection helps with setting up the Azure AD Custom Claims assignment for users.

```json theme={"system"}
{
  "info": {
    "_postman_id": "3db7dc21-7099-4584-94b9-cdaf2c542741",
    "name": "Azure AD Custom Claims assignment to users",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "896213"
  },
  "item": [
    {
      "name": "Step 1. Get extension app token",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "// Parse the response body\r",
              "let responseData = pm.response.json();\r",
              "\r",
              "// Extract the token\r",
              "let token = responseData.access_token;\r",
              "\r",
              "// Set the value as a collection variable\r",
              "pm.collectionVariables.set(\"azure_ad_application_token\", token);\r",
              "\r",
              "// Log for confirmation\r",
              "console.log(\"Token set as collection variable\");"
            ],
            "type": "text/javascript",
            "packages": {}
          }
        }
      ],
      "protocolProfileBehavior": {
        "disableBodyPruning": true
      },
      "request": {
        "method": "POST",
        "header": [],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "grant_type",
              "value": "client_credentials",
              "type": "text"
            },
            {
              "key": "client_id",
              "value": "{{extension_app_id}}",
              "type": "text"
            },
            {
              "key": "client_secret",
              "value": "{{extension_app_secret}}",
              "type": "text"
            },
            {
              "key": "scope",
              "value": "https://graph.microsoft.com/.default",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "https://login.microsoftonline.com/{{tenant_id}}/oauth2/v2.0/token",
          "protocol": "https",
          "host": [
            "login",
            "microsoftonline",
            "com"
          ],
          "path": [
            "{{tenant_id}}",
            "oauth2",
            "v2.0",
            "token"
          ]
        }
      },
      "response": []
    },
    {
      "name": "Step 2. Get user attributes",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{azure_ad_application_token}}",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [],
        "url": {
          "raw": "https://graph.microsoft.com/beta/users/{{user_object_id}}?$select=id,displayName,extension_{{extension_app_id_without_hyphens}}_store_ids,extension_{{extension_app_id_without_hyphens}}_chain_ids",
          "protocol": "https",
          "host": [
            "graph",
            "microsoft",
            "com"
          ],
          "path": [
            "beta",
            "users",
            "{{user_object_id}}"
          ],
          "query": [
            {
              "key": "$select",
              "value": "id,displayName,extension_{{extension_app_id_without_hyphens}}_store_ids,extension_{{extension_app_id_without_hyphens}}_chain_ids"
            }
          ]
        }
      },
      "response": []
    },
    {
      "name": "Step 3. Assign custom claim to the user",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{azure_ad_application_token}}",
              "type": "string"
            }
          ]
        },
        "method": "PATCH",
        "header": [],
        "body": {
          "mode": "raw",
          "raw": "{\r\n    \"extension_{{extension_app_id_without_hyphens}}_store_ids\": []\r\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "https://graph.microsoft.com/v1.0/users/{{user_object_id}}",
          "protocol": "https",
          "host": [
            "graph",
            "microsoft",
            "com"
          ],
          "path": [
            "v1.0",
            "users",
            "{{user_object_id}}"
          ]
        }
      },
      "response": []
    }
  ],
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "packages": {},
        "exec": [
          ""
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "packages": {},
        "exec": [
          ""
        ]
      }
    }
  ],
  "variable": [
    {
      "key": "tenant_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "extension_app_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "extension_app_id_without_hyphens",
      "value": "",
      "type": "string"
    },
    {
      "key": "extension_app_secret",
      "value": "",
      "type": "string"
    },
    {
      "key": "user_object_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "azure_ad_application_token",
      "value": "",
      "type": "string"
    }
  ]
}
```
