تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
هناك خيار آخر لإنشاء بيانات اعتماد OAuth2 وهو استخدام مساحة بروتوكول OAuth2. تتيح لك "مساحة بروتوكول OAuth2"، بالإضافة إلى "وحدة تحكّم واجهة Google API"، إنشاء رموز OAuth2 المميزة يدويًا.
تتوفّر أداة OAuth2 Playground للمستخدمين الذين يحتاجون فقط إلى الوصول إلى الحسابات الخاصة بحساب إداري واحد أو مستخدم واحد على "إعلانات Google". إذا كنت بحاجة إلى مطالبة عدة مستخدمين بتقديم بيانات الاعتماد، من الأفضل إعداد مكتبة برامج لبروتوكول OAuth في Google Ads API.
الحصول على معرّف عميل وسر عميل
إذا لم يكن لديك مشروع حالي على السحابة الإلكترونية، اتّبِع الخطوات التالية:
من القائمة المنسدلة الخاصة بالمشروع، اختَر مشروعًا حاليًا أو أنشِئ مشروعًا جديدًا.
في صفحة "بيانات الاعتماد"، انقر على إنشاء بيانات اعتماد، ثم انقر على معرّف عميل OAuth.
ضمن نوع التطبيق، اختَر تطبيق الويب.
ضمن معرّفات الموارد المنتظمة (URI) المعتمَدة لإعادة التوجيه، أضِف سطرًا يتضمّن ما يلي:
https://developers.google.com/oauthplayground
انقر على إنشاء.
في صفحة "معرّف العميل"، سجِّل معرّف العميل وسر العميل.
ستحتاج إلى هذه المعلومات في الخطوة التالية.
إذا كان لديك مشروع حالي على السحابة الإلكترونية، يمكنك إعادة استخدامه من خلال ضبط
معرّفات الموارد المنتظمة لإعادة التوجيه المصرّح بها كما هو موضّح في الخطوة 5.
إنشاء رموز مميّزة
انتقِل إلى مساحة بروتوكول OAuth2 (سيؤدي استخدام هذا الرابط إلى تعبئة بعض القيم الرئيسية تلقائيًا).
انقر على رمز الترس في أعلى يسار الصفحة، ثم ضَع علامة في المربّع بجانب استخدام بيانات اعتماد OAuth الخاصة بك (إذا لم يكن محدّدًا من قبل).
تأكَّد مما يلي:
يتم ضبط مسار OAuth على من جهة الخادم.
يتم ضبط نوع الوصول على بلا إنترنت (يضمن ذلك حصولك على رمز مميّز لإعادة التحميل و رمز دخول، بدلاً من رمز دخول فقط).
في القسم الذي يحمل العنوان الخطوة 1 - اختيار واجهات برمجة التطبيقات ومنح الإذن لها، انقر على Google Ads API من القائمة واختَر نطاقها، https://www.googleapis.com/auth/adwords. بعد ذلك، انقر على تفويض واجهات برمجة التطبيقات:
إذا طُلب منك ذلك، سجِّل الدخول إلى الحساب الذي تريد منح الإذن بالوصول إليه. بخلاف ذلك، تأكَّد من أنّ مستخدم Google الحالي في أعلى يسار الصفحة هو حساب "إعلانات Google" أو الحساب الإداري الذي تريد الحصول على بيانات الاعتماد الخاصة به.
ستظهر رسالة تطلب منك الموافقة على أن يتيح تطبيقك إدارة حملاتك على "إعلانات Google". انقر على قبول للمتابعة.
في علامة التبويب التي تحمل اسم الخطوة 2 - تبديل رمز التفويض بالرموز المميزة، من المفترض أن يظهر رمز التفويض. انقر على
Exchange authorization code for tokens (تبديل رمز التفويض بالرموز المميّزة).
إذا سارت الأمور على ما يرام، من المفترض أن يتم ملء رمز التحديث ورمز الدخول نيابةً عنك (قد تحتاج إلى إعادة توسيع الخطوة 2 - تبديل رمز التفويض بالرموز المميزة):
انسخ رمز التحديث إلى ملف الإعداد الخاص بمكتبة العميل التي تختارها، بالإضافة إلى معرّف العميل وسر العميل.
بعد الحصول على رمز مميز لإعادة التحميل، لن تحتاج إلى OAuth2 Playground ليكون معرّف موارد منتظمًا (URI) معتمَدًا لإعادة التوجيه. لإزالته من قائمة معرّفات الموارد المنتظمة (URI) المسموح بإعادة التوجيه إليها، اتّبِع الخطوات التالية:
في صفحة "بيانات الاعتماد"، انقر على اسم معرّف العميل لتعديله.
أزِل https://developers.google.com/oauthplayground من معرّفات الموارد المنتظمة (URI) المسموح بإعادة التوجيه إليها. يُرجى العِلم أنّه يجب ترك معرّف موارد منتظم واحد لإعادة التوجيه على الأقل.
تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe OAuth2 Playground helps generate OAuth2 credentials for single Google Ads user accounts.\u003c/p\u003e\n"],["\u003cp\u003eYou need a web application client ID and client secret to use the OAuth2 Playground.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves authorizing the Google Ads API and exchanging an authorization code for refresh and access tokens.\u003c/p\u003e\n"],["\u003cp\u003eAfter obtaining the refresh token, remove the OAuth2 Playground as an authorized redirect URI for security.\u003c/p\u003e\n"]]],[],null,["# OAuth Playground\n\nAnother option for generating OAuth2 credentials is to use the **OAuth2\nPlayground**. The OAuth2 Playground, in conjunction with the Google API Console,\nlets you manually create OAuth2 tokens.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThe OAuth2 Playground is for users who only need to access the accounts for a\n*single* manager account or Google Ads user. If you need to prompt multiple\nusers for credentials, it is likely better to [Configure a client library for\nOAuth in the Google Ads API](/google-ads/api/docs/oauth/client-library).\n\nGet a client ID and client secret\n---------------------------------\n\n| **Warning:** To use the **OAuth2 Playground** , you need to generate a **client\n| ID** for a [web application](/identity/protocols/OAuth2WebServer). This is the *only* type of application that works with the OAuth2 Playground. Refer to [Select an app type](/google-ads/api/docs/oauth/cloud-project#select_an_app_type) for more information.\n\nIf you don't have an existing cloud project:\n\n1. Open the [Google API Console\n Credentials page](https://console.cloud.google.com/apis/credentials).\n\n2. From the project drop-down, select an existing project or create a new one.\n\n3. On the Credentials page, select **Create credentials** , then select\n **OAuth client ID**.\n\n4. Under **Application type** , choose **Web application**.\n\n5. Under **Authorized redirect URIs** , add a line with:\n `https://developers.google.com/oauthplayground`\n\n6. Click **Create**.\n\n7. On the Client ID page, take note of the **client ID** and **client secret**.\n You'll need these in the next step.\n\nIf you have an existing cloud project, you can reuse it by setting the\nAuthorized redirect URIs as described in step 5.\n\nGenerate tokens\n---------------\n\n| **Warning:** The Google user you're signed in as in your browser determines which Google Ads accounts you'll be able to access with the OAuth2 credentials you generate. Therefore, you may want to do these steps in an incognito window or when you're not signed in to your Google Account, since it's likely that the user whose credentials you want to use isn't the same user you were signed in as when you got the client ID and secret.\n\n1. Go to the [OAuth2\n Playground](/oauthplayground#step1&scopes=https%3A//www.googleapis.com/auth/adwords&url=https%3A//&content_type=application/json&http_method=GET&useDefaultOauthCred=checked&oauthEndpointSelect=Google&oauthAuthEndpointValue=https%3A//accounts.google.com/o/oauth2/v2/auth&oauthTokenEndpointValue=https%3A//oauth2.googleapis.com/token&includeCredentials=unchecked&accessTokenType=bearer&autoRefreshToken=unchecked&accessType=offline&forceAprovalPrompt=checked&response_type=code),\n (using this link should pre-populate some key values for you).\n\n2. Click the gear icon\n in the upper right corner and select the box labeled **Use your own OAuth\n credentials** (if it isn't already selected).\n\n3. Make sure that:\n\n - **OAuth flow** is set to **Server-side**.\n - **Access type** is set to **Offline** (this ensures you get a refresh token *and* an access token, instead of just an access token).\n4. Enter the **OAuth2 client ID** and **OAuth2 client secret** you obtained above.\n\n5. In the section labeled **Step 1 - Select \\& authorize APIs** , click **Google\n Ads API** from the list and select its scope,\n `https://www.googleapis.com/auth/adwords`. Then click **Authorize APIs**:\n\n6. If prompted, sign in to the account to which you want to grant access and\n authorization. Otherwise, confirm that the current Google user in the top\n right corner is the Google Ads or manager account for whom you want to obtain\n credentials.\n\n | If you got your client ID and secret only a few minutes ago, and you get an error such as **Error: redirect_uri_mismatch** , the changes you made may not have propagated. Click the back button in your browser, wait a few minutes, then try clicking **Authorize APIs** again.\n\n \u003cbr /\u003e\n\n | If you get an error that you have not been granted access by the developer and the app is currently being tested, you will need to visit the OAuth consent screen page within your GCP project and do one of the following:\n |\n | \u003cbr /\u003e\n |\n | - Publish the app.\n |\n | - Keep the app in the Testing status, and add yourself as a test user.\n |\n \u003cbr /\u003e\n\n7. A prompt appears indicating your app would like to\n **Manage your Google Ads Campaigns** . Click **Accept** to continue.\n\n8. In the tab labeled **Step 2 - Exchange authorization code for tokens** ,\n an **Authorization code** should appear. Click\n **Exchange authorization code for tokens**.\n\n9. If all goes well, the **Refresh token** and **Access token** should be\n filled in for you (you may have to re-expand\n **Step 2 - Exchange authorization code for tokens**):\n\n10. Copy the **Refresh token** into the configuration file for your client\n library of choice, along with the **client ID** and **client secret**.\n\n11. [Configure a client library for OAuth in the Google Ads API](/google-ads/api/docs/oauth/client-library).\n\nRemove the OAuth2 Playground from your client ID\n------------------------------------------------\n\nNow that you have a **refresh token**, you no longer need the OAuth2 Playground\nto be an authorized redirect URI. To remove it from the list of authorized\nredirect URIs:\n\n1. Go to the [Google API Console Credentials page](https://console.cloud.google.com/apis/credentials).\n\n2. From the project drop-down, select your project.\n\n3. On the Credentials page, click the **client ID name** to edit.\n\n4. Remove `https://developers.google.com/oauthplayground` from the **Authorized\n redirect URIs** . Note that you must leave at least *one* redirect URI in\n place.\n\n5. Click **Save**."]]