> ## 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

> The three Microsoft Graph requests that put store and chain ids on an admin user's Azure AD account, as a Postman collection to import.

This collection is the last part of [Admin portal chain and store level access](/integration/get-started/admin-portal-chain-and-store-level-access). Import it into Postman, fill in the variables, and run its three requests to assign store or chain ids to an Azure AD user. The requests go to Microsoft Graph, not to Lobyco.

## Requests

| Request | Method | What it does |
| - | - | - |
| Step 1. Get extension app token | `POST` | Gets a token with the extension app's credentials and stores it as `azure_ad_application_token` |
| Step 2. Get user attributes | `GET` | Reads the user's `store_ids` and `chain_ids` extension properties |
| Step 3. Assign custom claim to the user | `PATCH` | Sets the `store_ids` or `chain_ids` property on the user |

The variables to fill in, and the order to run the requests in, are on the guide.

## The collection

Save this as a `.json` file and import it into Postman.

```json theme={"system"}
{
  "info": {
    "name": "Azure AD Custom Claims assignment to users",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "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"
    }
  ]
}
```

## Related

* [Admin portal chain and store level access](/integration/get-started/admin-portal-chain-and-store-level-access) — the setup this collection completes, and the variables to fill in.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.