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

# As-User Header

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

<RelatedLinks
  title="REQUIRED GUIDES"
  items={[
{ label: translate("OAuth 2.0 with SDKs"), href: "/guides/authentication/oauth2/with-sdk", badge: "GUIDE" }
]}
/>

It is possible to for an OAuth 2.0 application to act on behalf of another user
through the `as-user` header.

```sh theme={null}
curl https://api.box.com/2.0/folders/0 \
    -H "as-user: [USER_ID]"
    -H "authorization: Bearer [ACCESS_TOKEN]"
```

<Info>
  In this situation the user ID is the Box identifier for a user. User IDs can be
  found for any user via the `GET /users` endpoint, which is only available to
  admins, or by calling the `GET /users/me` endpoint with an authenticated user session.
</Info>

## Preconditions

Using the `as-user` header has a few requirements. Firstly, the application
needs to be configured to perform actions as users in the [Developer
Console][devconsole].

<Frame border center>
  <img src="https://mintcdn.com/box/J_EwM_J-GUl8Mc67/guides/authentication/oauth2/enable-perform-actions-as-users.png?fit=max&auto=format&n=J_EwM_J-GUl8Mc67&q=85&s=fcbd2fd7619224300d315b85d8a46558" alt="Advanced Features" width="1340" height="334" data-path="guides/authentication/oauth2/enable-perform-actions-as-users.png" />
</Frame>

Additionally, the authenticated user needs to be a user with admin permissions,
meaning either an admin, co-admin, or service account. Co-admin users will also
need the 'Manage Users' permission scope. See our guide on [User
Types](/platform/user-types) for more details.

## as-user using SDKs

<CodeGroup>
  ```csharp .NET theme={null}
  var user_client = new BoxClient(config, session, asUser: '[USER_ID]');
  ```

  ```java Java theme={null}
  client.asUser([USER_ID]");
  // client.asSelf();
  ```

  ```python Python theme={null}
  user_to_impersonate = client.user(user_id='[USER_ID]')
  user_client = client.as_user(user_to_impersonate)
  ```

  ```js Node theme={null}
  client.asUser('[USER_ID]');
  // client.asSelf();
  ```
</CodeGroup>

<Warning>
  Please note that some of our SDKs create new clients for the other user, while
  others modify the existing client and provide a way to return to a state where
  the client authenticates for the original user itself.
</Warning>

[devconsole]: https://app.box.com/developers/console

<RelatedLinks
  title="RELATED GUIDES"
  items={[
{ label: translate("Select Auth Method"), href: "/guides/authentication/select", badge: "GUIDE" }
]}
/>
