现在,您可以使用服务账号访问 Merchant Center 账号,方法是使用 Google 应用默认凭据流程或直接使用服务账号流程。Content API for Shopping 示例显示如何采用每种受支持的编程语言来使用两个流获取服务账号凭据。请查看代码示例以试用新服务账号,并了解在您自己的代码中使用服务账号需要做哪些更改。
常见问题解答
我可以使用服务账号登录 Merchant Center 界面吗?
不可以。服务账号不是常规 Google 账号,也无法访问 Merchant Center 界面。
我需要多久刷新一次服务账号访问令牌?
访问令牌在 Google OAuth 2.0 授权服务器签发一小时后过期。当访问令牌到期时,应用应使用客户端库来提取另一个访问令牌。
[[["易于理解","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"]],["最后更新时间 (UTC):2024-11-10。"],[[["Service accounts enable applications to programmatically access Google APIs, including the Content API for Shopping, using OAuth 2.0 without human intervention."],["To utilize service accounts, you need to generate service account credentials, add the service account as a user in your Merchant Center account, and then access your Merchant Center account using either the Google Application Default Credentials flow or the service account flow."],["Applications authenticated with service accounts can only access your own Merchant Center account; for third-party applications needing access to client accounts, refer to the Authorizing Requests guide."],["Service accounts cannot be used to sign in to the Merchant Center UI and access tokens expire after one hour, requiring the application to fetch a new one using the client library."]]],["Service accounts allow applications to access the Content API for Shopping programmatically. Key actions include: generating service account credentials by creating an OAuth 2.0 Client ID and a JSON private key file via the Google API Console, and adding the service account as a user within the Merchant Center account, specifying access and notification preferences. To access the Merchant center, you can use Google Application Default Credentials or a service account flow, with example code available. Access tokens expire hourly, requiring renewal.\n"]]