完成后,系统会显示一个 OAuth 2.0 客户端 ID 和客户端密钥,您可以将其下载为 JSON 格式进行保存,以备日后使用。
发出请求
AdMob API 是基于 HTTP 和 JSON 构建的,因此任何标准 HTTP 客户端均可向其发送请求并解析响应。不过,使用 Google API 客户端库将为您带来优势,例如语言集成更出色、安全性更高,且支持发出经过授权的请求。客户端库支持多种编程语言;使用客户端库可以避免手动设置 HTTP 请求和手动解析响应。
创建 OAuth 2.0 凭据后,您便可以开始使用 AdMob API 了。如需使用 OAuth 2.0 请求访问权限,您的应用还需要提供范围信息:
[null,null,["最后更新时间 (UTC):2024-11-08。"],[[["All Google AdMob API calls require OAuth2 authorization for your app to access user data securely without storing sensitive login credentials."],["Choose between desktop or web app authentication flow based on your app's needs and authorization process."],["Create or select a Google API project and enable the AdMob API before generating OAuth2 credentials."],["Make authorized requests to the AdMob API using HTTP clients or client libraries in various programming languages."],["Revoke access tokens through your Google account permissions or the Google Identity API when necessary."]]],["To use the Google AdMob API, authorize calls via OAuth2. First, create or select a project in the Google API Console and enable the AdMob API. Next, create OAuth2 credentials, choosing between \"Desktop app\" or \"Web app\" authentication types based on your needs. Configure the OAuth consent screen, download the generated client ID and secret, and then use these credentials to authorize requests with specified scopes, such as `admob.monetization` or `admob.readonly`. To start making requests, you can utilize the Google API client libraries. If you want to revoke access, you can do so from your Google account or using Google Identity API.\n"]]