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

# प्रमाणीकृत उपयोगकर्ता त्वरित शुरुआत

> वर्तमान प्रमाणीकृत उपयोगकर्ता की प्रोफ़ाइल प्राप्त करें

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <span>
          {children}
        </span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

यह गाइड आपको `/me` एंडपॉइंट का उपयोग करके वर्तमान में प्रमाणीकृत उपयोगकर्ता की प्रोफ़ाइल प्राप्त करने का तरीका बताती है।

<Note>
  **पूर्वापेक्षाएँ**

  शुरू करने से पहले, आपके पास ये होने चाहिए:

  * एक स्वीकृत ऐप के साथ [डेवलपर खाता](https://developer.x.com/en/portal/petition/essential/basic-info)
  * उपयोगकर्ता एक्सेस टोकन (OAuth 1.0a या OAuth 2.0 PKCE)
</Note>

***

<div id="get-the-authenticated-user">
  ## प्रमाणीकृत उपयोगकर्ता प्राप्त करें
</div>

उपयोगकर्ता एक्सेस टोकन का उपयोग करके `/me` एंडपॉइंट पर अनुरोध करें:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/users/me?\
  user.fields=created_at,description,verified,public_metrics,profile_image_url" \
    -H "Authorization: Bearer $USER_ACCESS_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_USER_ACCESS_TOKEN")

  # प्रमाणीकृत उपयोगकर्ता प्राप्त करें
  response = client.users.get_me(
      user_fields=["created_at", "description", "verified", "public_metrics", "profile_image_url"]
  )

  print(f"Username: {response.data.username}")
  print(f"ID: {response.data.id}")
  print(f"Followers: {response.data.public_metrics.followers_count}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ accessToken: "YOUR_USER_ACCESS_TOKEN" });

  // प्रमाणीकृत उपयोगकर्ता प्राप्त करें
  const response = await client.users.getMe({
    userFields: ["created_at", "description", "verified", "public_metrics", "profile_image_url"],
  });

  console.log(`Username: ${response.data?.username}`);
  console.log(`ID: ${response.data?.id}`);
  console.log(`Followers: ${response.data?.public_metrics?.followers_count}`);
  ```
</CodeGroup>

***

<div id="response">
  ## रिस्पॉन्स
</div>

```json theme={null}
{
  "data": {
    "id": "2244994945",
    "name": "X Developers",
    "username": "XDevelopers",
    "created_at": "2013-12-14T04:35:55.000Z",
    "description": "The voice of the X developer community",
    "verified": true,
    "profile_image_url": "https://pbs.twimg.com/profile_images/...",
    "public_metrics": {
      "followers_count": 583423,
      "following_count": 2048,
      "tweet_count": 14052,
      "listed_count": 1672
    }
  }
}
```

***

<div id="use-case">
  ## उपयोग के मामले
</div>

`/me` एंडपॉइंट इन स्थितियों में आवश्यक है:

* **प्रमाणीकरण सत्यापित करना** — पुष्टि करें कि उपयोगकर्ता सही तरीके से प्रमाणित है
* **उपयोगकर्ता ID प्राप्त करना** — अन्य API कॉल के लिए प्रमाणीकृत उपयोगकर्ता की ID प्राप्त करें
* **अनुभव को वैयक्तिकृत करना** — अपने ऐप में उपयोगकर्ता की प्रोफ़ाइल दिखाएँ
* **किसी उपयोगकर्ता की ओर से अनुरोध करना** — जानें कि आप किसकी ओर से अनुरोध कर रहे हैं

***

<div id="include-pinned-post">
  ## पिन की गई पोस्ट शामिल करें
</div>

उपयोगकर्ता की पिन की गई पोस्ट का अनुरोध करने के लिए:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/users/me?\
  user.fields=pinned_tweet_id&\
  expansions=pinned_tweet_id&\
  tweet.fields=created_at,text" \
    -H "Authorization: Bearer $USER_ACCESS_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_USER_ACCESS_TOKEN")

  # पिन की गई पोस्ट के साथ प्रमाणीकृत उपयोगकर्ता प्राप्त करें
  response = client.users.get_me(
      user_fields=["pinned_tweet_id"],
      expansions=["pinned_tweet_id"],
      tweet_fields=["created_at", "text"]
  )

  print(f"Username: {response.data.username}")
  # पिन की गई पोस्ट response.includes.tweets में होती है
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ accessToken: "YOUR_USER_ACCESS_TOKEN" });

  // पिन की गई पोस्ट के साथ प्रमाणीकृत उपयोगकर्ता प्राप्त करें
  const response = await client.users.getMe({
    userFields: ["pinned_tweet_id"],
    expansions: ["pinned_tweet_id"],
    tweetFields: ["created_at", "text"],
  });

  console.log(`Username: ${response.data?.username}`);
  // पिन की गई पोस्ट response.includes?.tweets में होती है
  ```
</CodeGroup>

<div id="response-with-expansion">
  ### एक्सपैंशन सहित रिस्पॉन्स
</div>

```json theme={null}
{
  "data": {
    "id": "2244994945",
    "name": "X Developers",
    "username": "XDevelopers",
    "pinned_tweet_id": "1234567890"
  },
  "includes": {
    "tweets": [
      {
        "id": "1234567890",
        "text": "Welcome to my profile!",
        "created_at": "2024-01-01T00:00:00.000Z"
      }
    ]
  }
}
```

***

<div id="available-fields">
  ## उपलब्ध फ़ील्ड्स
</div>

| फ़ील्ड              | विवरण                                |
| :------------------ | :----------------------------------- |
| `created_at`        | खाता बनाए जाने की तारीख              |
| `description`       | उपयोगकर्ता का परिचय                  |
| `profile_image_url` | प्रोफ़ाइल चित्र का URL               |
| `verified`          | सत्यापन की स्थिति                    |
| `public_metrics`    | फ़ॉलोअर/फ़ॉलोइंग की संख्या           |
| `location`          | उपयोगकर्ता द्वारा सेट किया गया स्थान |
| `url`               | उपयोगकर्ता की वेबसाइट                |
| `protected`         | सुरक्षित खाते की स्थिति              |
| `pinned_tweet_id`   | पिन की गई पोस्ट की ID                |

***

<div id="authentication-requirement">
  ## प्रमाणीकरण की आवश्यकता
</div>

<Warning>
  `/me` एंडपॉइंट के लिए User Context प्रमाणीकरण आवश्यक है। App-Only (बेयरर टोकन) प्रमाणीकरण समर्थित नहीं है।
</Warning>

इनमें से किसी एक का उपयोग करें:

* [OAuth 1.0a User Context](/hi/resources/fundamentals/authentication)
* [PKCE के साथ OAuth 2.0 Authorization Code](/hi/resources/fundamentals/authentication#oauth-2-0-authorization-code-flow-with-pkce-2)

***

<div id="next-steps">
  ## अगले चरण
</div>

<CardGroup cols={2}>
  <Card title="उपयोगकर्ता लुकअप" icon="users" href="/hi/x-api/users/lookup/quickstart/user-lookup">
    अन्य उपयोगकर्ताओं को ढूँढें
  </Card>

  <Card title="एकीकरण मार्गदर्शिका" icon="book" href="/hi/x-api/users/lookup/integrate">
    मुख्य अवधारणाएँ और सर्वोत्तम प्रक्रियाएँ
  </Card>

  <Card title="API संदर्भ" icon="code" href="/hi/x-api/users/authenticated-user-lookup">
    एंडपॉइंट का पूरा दस्तावेज़
  </Card>
</CardGroup>
