Authentication
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
এই ডকুমেন্ট বর্ণনা করে কিভাবে Ad Manager API-এ প্রমাণীকরণ করতে হয়। আপনি কীভাবে প্রমাণীকরণ করবেন তা নির্ভর করে আপনার ব্যবহার করা ইন্টারফেস এবং আপনার কোডটি যে পরিবেশে চলছে তার উপর, তবে সমস্ত API অনুরোধে অ্যাড ম্যানেজার API স্কোপের সাথে একটি অ্যাক্সেস টোকেন অন্তর্ভুক্ত করতে হবে।
অ্যাড ম্যানেজার ক্লায়েন্ট লাইব্রেরিগুলি অ্যাড ম্যানেজার API স্কোপের সাথে অ্যাক্সেস টোকেন তৈরি করতে অ্যাপ্লিকেশন ডিফল্ট শংসাপত্র ব্যবহার করে। এই নির্দেশিকাটি দেখায় কিভাবে অ্যাপ্লিকেশন ডিফল্ট শংসাপত্র কনফিগার করতে হয়।
আপনি যদি একটি ক্লায়েন্ট লাইব্রেরি ব্যবহার না করেন, তবে আপনাকে এখনও শংসাপত্র তৈরি করতে হবে এবং আপনার অনুরোধগুলি অনুমোদন করতে সেগুলি ব্যবহার করতে হবে৷
প্রমাণীকরণ এবং অনুমোদন সম্পর্কে আরও তথ্যের জন্য, OAuth 2.0 ব্যবহার করার নির্দেশিকা দেখুন।
আপনার প্রমাণীকরণের ধরন নির্ধারণ করুন
প্রমাণীকরণ প্রকার | বর্ণনা |
---|
পরিষেবা অ্যাকাউন্ট | আপনি যদি কোনও নির্দিষ্ট ব্যক্তির পরিবর্তে ডেডিকেটেড অ্যাকাউন্ট হিসাবে প্রমাণীকরণ করতে চান তবে এটি বেছে নিন। আরও জানুন |
ওয়েব অ্যাপ্লিকেশন | আপনি যদি আপনার অ্যাপ্লিকেশনটিকে তাদের অ্যাড ম্যানেজার ডেটা অ্যাক্সেস করার অনুমতি দেয় এমন কোনও ব্যবহারকারী হিসাবে প্রমাণীকরণ করতে চান তবে এটি চয়ন করুন৷ আরও জানুন |
স্থানীয় উন্নয়ন | আপনি যদি নিজের Google অ্যাকাউন্ট বা আপনার স্থানীয় উন্নয়ন পরিবেশ থেকে একটি পরিষেবা অ্যাকাউন্ট হিসাবে প্রমাণীকরণ করতে চান তবে এটি চয়ন করুন৷ |
অ্যাড ম্যানেজার API সক্ষম করুন
আপনার Google API কনসোল ক্লাউড প্রোজেক্টে অ্যাড ম্যানেজার API সক্ষম করুন।
অনুরোধ করা হলে, একটি প্রকল্প নির্বাচন করুন, বা একটি নতুন তৈরি করুন৷
শংসাপত্র তৈরি করুন
আপনার প্রমাণীকরণ প্রকারের জন্য ট্যাবে ক্লিক করুন এবং আপনার শংসাপত্র তৈরি করতে নির্দেশাবলী অনুসরণ করুন:
পরিষেবা অ্যাকাউন্ট
গুগল ক্লাউডে
Google ক্লাউডে চলমান একটি কাজের চাপকে প্রমাণীকরণ করতে, আপনি কম্পিউট রিসোর্সের সাথে সংযুক্ত পরিষেবা অ্যাকাউন্টের শংসাপত্র ব্যবহার করেন যেখানে আপনার কোড চলছে৷
উদাহরণস্বরূপ, আপনি একটি কম্পিউট ইঞ্জিন ভার্চুয়াল মেশিন (ভিএম) উদাহরণ, একটি ক্লাউড রান পরিষেবা বা ডেটাফ্লো কাজের সাথে একটি পরিষেবা অ্যাকাউন্ট সংযুক্ত করতে পারেন। এই পদ্ধতিটি Google ক্লাউড কম্পিউট রিসোর্সে চলমান কোডের জন্য পছন্দের প্রমাণীকরণ পদ্ধতি।
আপনি কোন সংস্থানগুলির সাথে একটি পরিষেবা অ্যাকাউন্ট সংযুক্ত করতে পারেন এবং সংস্থানের সাথে পরিষেবা অ্যাকাউন্ট সংযুক্ত করতে সহায়তা করতে পারেন সে সম্পর্কে তথ্যের জন্য, একটি পরিষেবা অ্যাকাউন্ট সংযুক্ত করার ডকুমেন্টেশন দেখুন৷
প্রাঙ্গনে বা একটি ভিন্ন ক্লাউড প্রদানকারীতে
Google ক্লাউডের বাইরে থেকে প্রমাণীকরণ সেট আপ করার পছন্দের পদ্ধতি হল ওয়ার্কলোড আইডেন্টিটি ফেডারেশন ব্যবহার করা; আপনি একটি শংসাপত্র কনফিগারেশন ফাইল তৈরি করুন এবং এটিকে নির্দেশ করার জন্য GOOGLE_APPLICATION_CREDENTIALS
পরিবেশ পরিবর্তনশীল সেট করুন৷ এই পদ্ধতিটি একটি পরিষেবা অ্যাকাউন্ট কী তৈরি করার চেয়ে আরও নিরাপদ।
আপনি যদি ওয়ার্কলোড আইডেন্টিটি ফেডারেশন কনফিগার করতে না পারেন, তাহলে আপনাকে অবশ্যই একটি পরিষেবা অ্যাকাউন্ট তৈরি করতে হবে এবং পরিষেবা অ্যাকাউন্টের জন্য একটি কী তৈরি করতে হবে:
Google API কনসোল শংসাপত্র পৃষ্ঠা খুলুন।
শংসাপত্র পৃষ্ঠায়, শংসাপত্র তৈরি করুন নির্বাচন করুন, তারপরে পরিষেবা অ্যাকাউন্ট নির্বাচন করুন।
আপনি যে পরিষেবা অ্যাকাউন্টের জন্য একটি কী তৈরি করতে চান তার ইমেল ঠিকানাটিতে ক্লিক করুন।
কী ট্যাবে ক্লিক করুন।
যোগ কী ড্রপ-ডাউন মেনুতে ক্লিক করুন, তারপর নতুন কী তৈরি করুন নির্বাচন করুন।
কী টাইপ হিসাবে JSON নির্বাচন করুন এবং তৈরি করুন ক্লিক করুন।
JSON ফাইলের পাথে পরিবেশ পরিবর্তনশীল GOOGLE_APPLICATION_CREDENTIALS
সেট করুন।
লিনাক্স বা ম্যাকোস
export GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH
উইন্ডোজ
set GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH
ওয়েব অ্যাপ্লিকেশন
Google API কনসোল শংসাপত্র পৃষ্ঠা খুলুন।
প্রম্পট করা হলে, আপনি যে প্রজেক্টে অ্যাড ম্যানেজার এপিআই চালু করেছেন সেটি বেছে নিন।
শংসাপত্র পৃষ্ঠায়, শংসাপত্র তৈরি করুন নির্বাচন করুন, তারপরে OAuth ক্লায়েন্ট আইডি নির্বাচন করুন।
ওয়েব অ্যাপ্লিকেশন অ্যাপ্লিকেশন প্রকার নির্বাচন করুন.
ফর্মটি পূরণ করুন এবং তৈরি করুন ক্লিক করুন। PHP, Java, Python, Ruby, এবং .NET এর মত ভাষা এবং ফ্রেমওয়ার্ক ব্যবহার করে এমন অ্যাপ্লিকেশনগুলিকে অবশ্যই অনুমোদিত রিডাইরেক্ট URI উল্লেখ করতে হবে। রিডাইরেক্ট ইউআরআই হল শেষ পয়েন্ট যেখানে OAuth 2.0 সার্ভার প্রতিক্রিয়া পাঠাতে পারে। এই শেষ পয়েন্টগুলি অবশ্যই Google-এর বৈধতা নিয়ম মেনে চলতে হবে৷
আপনার শংসাপত্র তৈরি করার পরে, client_secret.json ফাইলটি ডাউনলোড করুন। ফাইলটিকে নিরাপদে এমন একটি স্থানে সংরক্ষণ করুন যেখানে শুধুমাত্র আপনার অ্যাপ্লিকেশন অ্যাক্সেস করতে পারে।
এখান থেকে, OAuth 2.0 অ্যাক্সেস টোকেন পেতে পদক্ষেপগুলি অনুসরণ করুন৷
স্থানীয় উন্নয়ন
আপনার স্থানীয় পরিবেশে অ্যাপ্লিকেশন ডিফল্ট শংসাপত্র (ADC) সেট আপ করুন।
গুগল ক্লাউড সিএলআই ইনস্টল করুন, তারপরে নিম্নলিখিত কমান্ডটি চালিয়ে এটি শুরু করুন:
gcloud init
আপনার Google অ্যাকাউন্টের জন্য স্থানীয় প্রমাণীকরণ শংসাপত্র তৈরি করুন এবং প্রজেক্ট আইডিটিকে এমন একটি প্রকল্পে সেট করুন যেখানে অ্যাড ম্যানেজার এপিআই সক্ষম করা আছে:
gcloud auth application-default login --scopes="https://www.googleapis.com/auth/admanager"
gcloud auth application-default set-quota-project PROJECT_ID
বিকল্পভাবে, আপনার কী ফাইলের পাথে পরিবেশ পরিবর্তনশীল GOOGLE_APPLICATION_CREDENTIALS
সেট করে একটি পরিষেবা অ্যাকাউন্ট হিসাবে প্রমাণীকরণ করুন।
লিনাক্স বা ম্যাকোস
export GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH
উইন্ডোজ
set GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH
পরিষেবা অ্যাকাউন্ট
- আপনার অ্যাড ম্যানেজার নেটওয়ার্কে যান।
- অ্যাডমিন ট্যাবে ক্লিক করুন।
- নিশ্চিত করুন যে API অ্যাক্সেস সক্ষম করা আছে।
- একটি পরিষেবা অ্যাকাউন্ট ব্যবহারকারী যোগ করুন বোতামে ক্লিক করুন।
- পরিষেবা অ্যাকাউন্ট ইমেল ব্যবহার করে ফর্ম পূরণ করুন. আপনার API একীকরণের জন্য পরিষেবা অ্যাকাউন্ট ব্যবহারকারীকে অবশ্যই উপযুক্ত ভূমিকা এবং দলগুলিতে যোগ করতে হবে৷
- সেভ বাটনে ক্লিক করুন। আপনার পরিষেবা অ্যাকাউন্ট যোগ করার বিষয়টি নিশ্চিত করে একটি বার্তা উপস্থিত হওয়া উচিত।
- ব্যবহারকারী ট্যাবে গিয়ে এবং তারপর পরিষেবা অ্যাকাউন্ট ফিল্টারে ক্লিক করে বিদ্যমান পরিষেবা অ্যাকাউন্ট ব্যবহারকারীদের দেখুন৷
ক্লায়েন্ট লাইব্রেরি ছাড়া
আপনি যদি একটি ক্লায়েন্ট লাইব্রেরি ব্যবহার না করেন, আমরা এখনও দৃঢ়ভাবে প্রমাণীকরণের জন্য একটি OAuth2 লাইব্রেরি ব্যবহার করার পরামর্শ দিই।
অ্যাক্সেস টোকেন পাওয়ার বিষয়ে বিস্তারিত নির্দেশাবলীর জন্য, Google API-এর সাথে OAuth2 ব্যবহার করা দেখুন।
টোকেন অ্যাক্সেস করুন
একটি access_token
ক্যোয়ারী প্যারামিটার বা একটি Authorization
HTTP শিরোনাম Bearer
মান অন্তর্ভুক্ত করে API-তে একটি অনুরোধে আপনার অ্যাক্সেস টোকেন অন্তর্ভুক্ত করুন। যখন সম্ভব, HTTP শিরোনামটি পছন্দনীয়, কারণ সার্ভার লগগুলিতে কোয়েরি স্ট্রিংগুলি দৃশ্যমান হয়।
যেমন:
GET /v1/networks/1234
Host: admanager.googleapis.com
Authorization: Bearer ya29.a0Ad52N3_shYLX
GET https://admanager.googleapis.com/v1/networks/1234?access_token=1/fFAGRNJru1FTz70BzhT3Zg
ব্যাপ্তি
প্রতিটি অ্যাক্সেস টোকেন এক বা একাধিক স্কোপের সাথে যুক্ত। একটি স্কোপ সম্পদ এবং ক্রিয়াকলাপগুলির সেট নিয়ন্ত্রণ করে যা একটি অ্যাক্সেস টোকেন অনুমতি দেয়। Ad Manager API-এর শুধুমাত্র একটি সুযোগ রয়েছে। অনুমোদন পণ্যের মধ্যে ব্যবহারকারী স্তরে সঞ্চালিত করা উচিত.
ব্যাপ্তি | অনুমতি |
---|
https://www.googleapis.com/auth/admanager | গুগল অ্যাড ম্যানেজারে আপনার প্রচারগুলি দেখুন এবং পরিচালনা করুন৷ |
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-29 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-08-29 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eGoogle Ad Manager API authentication depends on the interface and environment but always requires an access token.\u003c/p\u003e\n"],["\u003cp\u003eChoose between service account, web application, or local development authentication based on your needs.\u003c/p\u003e\n"],["\u003cp\u003eEnable the Ad Manager API in your Google API Console and create the necessary credentials for your chosen authentication type.\u003c/p\u003e\n"],["\u003cp\u003eConfigure your Ad Manager network settings and add the service account user or enable API access depending on authentication type.\u003c/p\u003e\n"],["\u003cp\u003eInclude your access token in API requests using either a query parameter or an HTTP header.\u003c/p\u003e\n"]]],["To access the Ad Manager API, you need an access token, generated using Application Default Credentials (ADC) or custom credentials. First, enable the Ad Manager API in your Google Cloud project. Then, choose an authentication type: Service Account, Web application, or Local development. Create credentials via the Google API Console, selecting the appropriate method. If not using a client library, use an OAuth2 library. Finally, include the access token in API requests, preferably in the `Authorization` HTTP header. Each access token should be associated with the `https://www.googleapis.com/auth/admanager` scope.\n"],null,["# Authentication\n\nThis document describes how to authenticate to the Ad Manager API. How you\nauthenticate depends on the interface you use and the environment where your\ncode is running, but all API requests must include an access token with the\nAd Manager API [scope](#scope).\n\nThe Ad Manager client libraries use [Application Default Credentials](//cloud.google.com/docs/authentication/application-default-credentials)\nto generate access tokens with the Ad Manager API scope. This guide shows\nhow to configure Application Default Credentials.\n\nIf you aren't using a client library, you still need to create credentials\nand use them to authorize your requests.\n\nFor more information about authentication and authorization, see the\n[Using OAuth 2.0](/identity/protocols/oauth2) guide.\n\nDetermine your authentication type\n----------------------------------\n\n| Authentication type | Description |\n|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Service Account | Choose this if you want to authenticate as dedicated account rather than a particular person. [Learn more](//cloud.google.com/iam/docs/service-account-overview). |\n| Web application | Choose this if you want to authenticate as any user who grants permission to your application to access their Ad Manager data. [Learn more](/identity/oauth2/web/guides/overview) |\n| Local development | Choose this if you want to authenticate as your own Google Account or a Service Account from your local development environment. |\n\nEnable the Ad Manager API\n-------------------------\n\n1. Enable the [Ad Manager API](https://console.cloud.google.com/apis/library/admanager.googleapis.com) in your\n Google API Console Cloud Project.\n\n2. If prompted, select a project, or create a new one.\n\nCreate credentials\n------------------\n\nClick the tab for your authentication type and follow the instructions to\ncreate your credentials: \n\n### Service Account\n\n### On Google Cloud\n\nTo authenticate a workload running on Google Cloud, you use the credentials of\nthe service account attached to the compute resource where your code is\nrunning.\n\nFor example, you can attach a service account to a Compute Engine virtual\nmachine (VM) instance, a Cloud Run service, or a Dataflow job. This approach\nis the preferred authentication method for code running on a Google Cloud\ncompute resource.\n\nFor information about which resources you can attach a service account to,\nand help with attaching the service account to the resource, see the\n[documentation on attaching a service account](//cloud.google.com/iam/docs/attach-service-accounts).\n\n### On-premises or on a different cloud provider\n\nThe preferred method to set up authentication from outside of Google Cloud is\nto use [workload identity federation](//cloud.google.com/iam/docs/workload-identity-federation); you create a\ncredential configuration file and set the `GOOGLE_APPLICATION_CREDENTIALS`\nenvironment variable to point to it. This approach is more secure than\ncreating a service account key.\n\nIf you are not able to configure workload identity federation, then you must\ncreate a service account and create a key for the service account:\n\n1. Open the [Google API Console Credentials page](https://console.cloud.google.com/apis/credentials).\n\n2. On the Credentials page, select **Create credentials** , then\n select **Service Account**.\n\n3. Click the email address of the service account that you want to create\n a key for.\n\n4. Click the **Keys** tab.\n\n5. Click the **Add key** drop-down menu, then select **Create new key**.\n\n6. Select **JSON** as the **Key type** and click **Create**.\n\n7. Set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to the path\n of the JSON file.\n\n#### Linux or macOS\n\n export GOOGLE_APPLICATION_CREDENTIALS=\u003cvar label=\"key file\" translate=\"no\"\u003eKEY_FILE_PATH\u003c/var\u003e\n\n#### Windows\n\n set GOOGLE_APPLICATION_CREDENTIALS=\u003cvar label=\"key file\" translate=\"no\"\u003eKEY_FILE_PATH\u003c/var\u003e\n\n### Web application\n\n1. Open the [Google API Console Credentials page](https://console.cloud.google.com/apis/credentials).\n\n2. If prompted, select the project where you enabled the Ad Manager API.\n\n3. On the Credentials page, select **Create credentials** , then\n select **OAuth client ID**.\n\n4. Select the **Web application** application type.\n\n5. Fill in the form and click **Create** . Applications that use languages and\n frameworks like PHP, Java, Python, Ruby, and .NET must specify authorized\n **redirect URIs** . The redirect URIs are the endpoints to which the OAuth 2.0\n server can send responses. These endpoints must adhere to [Google's\n validation rules](/identity/protocols/oauth2/web-server#uri-validation).\n\n6. After creating your credentials, download the **client_secret.json** file. Securely store the file in a location that only your application can access.\n\nFrom here, follow the steps to [obtain OAuth 2.0 access tokens](/identity/protocols/oauth2/web-server#obtainingaccesstokens)\n\n### Local development\n\nSet up Application Default Credentials (ADC) in your local environment.\n\nInstall the Google Cloud CLI, then initialize it by running the following\ncommand: \n\n gcloud init\n\nCreate local authentication credentials for your Google Account and set\nthe project ID to a project where the Ad Manager API is enabled: \n\n gcloud auth application-default login --scopes=\"https://www.googleapis.com/auth/admanager\"\n gcloud auth application-default set-quota-project \u003cvar label=\"project id\" translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\nAlternatively, authenticate as a Service Account setting the environment\nvariable `GOOGLE_APPLICATION_CREDENTIALS` to the path of your key file.\n\n#### Linux or macOS\n\n export GOOGLE_APPLICATION_CREDENTIALS=\u003cvar label=\"key file\" translate=\"no\"\u003eKEY_FILE_PATH\u003c/var\u003e\n\n#### Windows\n\n set GOOGLE_APPLICATION_CREDENTIALS=\u003cvar label=\"key file\" translate=\"no\"\u003eKEY_FILE_PATH\u003c/var\u003e\n\nConfigure your Ad Manager network\n---------------------------------\n\n**Tip:** If you are a third-party developer, ask your client to complete this step for you. Send them to [Add a service account user for API access](//support.google.com/admanager/answer/6078734) and provide the email address of your service account. \n\n### Service Account\n\n1. Go to your [Ad Manager network](//admanager.google.com).\n2. Click the **Admin** tab.\n3. Ensure that **API access** is enabled.\n4. Click the **Add a service account user** button.\n5. Fill in the form using the service account email. The service account user must be added to appropriate roles and teams for your API integration.\n6. Click the **Save** button. A message should appear, confirming the addition of your service account.\n7. View existing service account users by going to the Users tab and then clicking the **Service Account** filter.\n\n### Web application\n\n1. Go to your [Ad Manager network](//admanager.google.com).\n2. Click the **Admin** tab.\n3. Ensure that **API access** is enabled.\n\n### Local Development\n\n1. Go to your [Ad Manager network](//admanager.google.com).\n2. Click the **Admin** tab.\n3. Ensure that **API access** is enabled.\n\nWithout a client library\n------------------------\n\nIf you are not using a client library, we still strongly recommend using\nan OAuth2 library for authentication.\n\nFor detailed instructions on obtaining access tokens, see\n[Using OAuth2 with Google APIs](/identity/protocols/oauth2).\n\n### Access tokens\n\nInclude your access token in a request to the API by including either an\n`access_token` query parameter or an `Authorization` HTTP header `Bearer` value.\nWhen possible, the HTTP header is preferable, because query strings tend to be\nvisible in server logs.\n\nFor example: \n\n GET /v1/networks/1234\n Host: admanager.googleapis.com\n Authorization: Bearer ya29.a0Ad52N3_shYLX\n\n GET https://admanager.googleapis.com/v1/networks/1234?access_token=1/fFAGRNJru1FTz70BzhT3Zg\n\n### Scope\n\nEach access token is associated with one or more scopes. A scope controls the\nset of resources and operations that an access token permits. The Ad Manager\nAPI has only one scope. Authorization should be performed at the user\nlevel within the product.\n\n| Scope | Permissions |\n|---------------------------------------------|------------------------------------------------------|\n| `https://www.googleapis.com/auth/admanager` | View and manage your campaigns on Google Ad Manager. |"]]