授權
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您的應用程式傳送至 AdMob API 的每項要求都必須包含授權權杖。這個權杖也可讓 Google 識別您的應用程式。
關於授權通訊協定
您的應用程式必須使用 OAuth 2.0 對要求進行授權,系統不支援其他授權通訊協定。如果您的應用程式採用使用 Google 帳戶登入功能,系統會為您處理部分授權事項。
使用 OAuth 2.0 對要求進行授權
所有 AdMob API 要求都必須獲得已驗證使用者的授權。
您必須使用 OAuth 用戶端 ID 進行這項程序。
取得 OAuth 用戶端 ID
或者,您也可以在「憑證」頁面中建立一個。
OAuth 2.0 授權程序 (或「流程」) 的細節會根據您編寫的應用程式類型而有所不同。下列一般程序適用於所有應用程式類型:
- 當應用程式需要存取使用者資料時,會向 Google 要求特定的存取範圍。
- Google 會向使用者顯示同意畫面,請對方授權您的應用程式要求部分資料。
- 如果使用者同意,Google 即會授予短期存取權杖給您的應用程式。
- 您的應用程式向使用者要求資料,並且在要求中附上存取權杖。
- 如果 Google 判定您的要求與權杖有效,便會傳回您要求的資料。
部分流程包含額外步驟,例如使用「更新權杖」來取得新的存取權杖。如要進一步瞭解各類應用程式的流程,請參閱 Google 的 OAuth 2.0 說明文件。
以下列出 AdMob API 的 OAuth 2.0 範圍相關資訊:
範圍 |
意義 |
https://www.googleapis.com/auth/admob.readonly |
查看所有 AdMob 資料。這些 AdMob 資料可能包含帳戶資訊、廣告空間和中介服務設定、報表以及其他資料。但不含付款或廣告活動詳細資料等機密資料。
|
https://www.googleapis.com/auth/admob.report |
查看廣告成效和收益報表。查看發布商 ID、時區和預設貨幣代碼。 |
如要透過 OAuth 2.0 要求存取權,您的應用程式需要範圍資訊,以及 Google 在您註冊應用程式時提供的資訊 (例如用戶端 ID 和用戶端密碼)。
提示:Google API 用戶端程式庫可以為您處理部分授權程序,且適用於多種程式設計語言;詳情請參閱程式庫和範例頁面。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-11-08 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-11-08 (世界標準時間)。"],[[["Every AdMob API request requires an authorization token for application identification and user data access."],["AdMob API exclusively supports OAuth 2.0 for authorization, requiring applications to obtain user consent and access tokens."],["Applications need an OAuth client ID and specific scopes to request access to AdMob data like account information or reports."],["Google provides client libraries to simplify the authorization process across various programming languages."]]],["All AdMob API requests require an OAuth 2.0 authorization token, obtainable via an OAuth client ID. The application requests a specific access scope, which prompts Google to display a consent screen to the user. Upon approval, Google grants a short-lived access token. The application then uses this token to request data. Access scopes include `admob.readonly` for general data and `admob.report` for performance reports. Google APIs client libraries can help manage parts of the process.\n"]]