[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-20。"],[[["\u003cp\u003eThe \u003ccode\u003eREGION_ID\u003c/code\u003e is a Google-assigned code based on the region selected during app creation, included in App Engine URLs for apps created after February 2020, but optional for older apps.\u003c/p\u003e\n"],["\u003cp\u003eThe App Identity API allows an application to discover its project ID, enabling it to assert its identity to other apps, Google APIs, and third-party services.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine apps are served from URLs containing the project ID and \u003ccode\u003eREGION_ID\u003c/code\u003e, and the hostname can be retrieved using the API.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eX-Appengine-Inbound-Appid\u003c/code\u003e header, present in calls to the \u003ccode\u003eappspot.com\u003c/code\u003e domain, identifies the requesting application's project ID.\u003c/p\u003e\n"],["\u003cp\u003eThe App Identity API can create OAuth tokens for authenticating requests to Google APIs and sign bytes to assert identity to third-party services.\u003c/p\u003e\n"]]],[],null,["# App Identity API for legacy bundled services\n\n### Region ID\n\nThe \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e is an abbreviated code that Google assigns\nbased on the region you select when you create your app. The code does not\ncorrespond to a country or province, even though some region IDs may appear\nsimilar to commonly used country and province codes. For apps created after\nFebruary 2020, \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e`.r` is included in\nApp Engine URLs. For existing apps created before this date, the\nregion ID is optional in the URL.\n\nLearn more\n[about region IDs](/appengine/docs/standard/python/how-requests-are-routed#region-id). \nOK \nGo Java PHP Python\n\nThe App Identity API lets an application discover its application ID (also\ncalled the [project ID](https://support.google.com/cloud/answer/6158840)). Using\nthe ID, an App Engine application can assert its identity to other App Engine\nApps, Google APIs, and third-party applications and services. The\napplication ID can also be used to generate a URL or email address, or to make\na run-time decision.\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n|\n| /services/access). If you are updating to the App Engine runtime, refer to the [Upgrade to second-generation runtimes]() page to learn about your migration options for legacy bundled services.\n\nGetting the project ID\n----------------------\n\nThe project ID can be found using the\n\nGetting the application hostname\n--------------------------------\n\nBy default, App Engine apps are served from URLs in the form\n\n`https://`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003eREGION_ID\u003c/a\u003e\u003c/var\u003e`.r.appspot.com`, where the project ID is part of the hostname.\nIf an app is served from a custom domain, it may be necessary to retrieve the\nentire hostname component. You can do this using the\n\n\nAsserting identity to other App Engine apps\n-------------------------------------------\n\nIf you want to determine the identity of the App Engine app that is making a\nrequest to your App Engine app, you can use the request header\n`X-Appengine-Inbound-Appid`. This header is added to the request by the URLFetch\nservice and is not user modifiable, so it safely indicates the requesting\napplication's project ID, if present.\n\n**Requirements**:\n\n- Only calls made to your app's `appspot.com` domain will contain\n the `X-Appengine-Inbound-Appid` header. Calls to custom domains\n do not contain the header.\n\n \u003cbr /\u003e\n\nIn your application handler, you can check the incoming ID by reading the\n`X-Appengine-Inbound-Appid` header and comparing it to a list of IDs allowed\nto make requests.\n\nAsserting identity to Google APIs\n---------------------------------\n\nGoogle APIs use the OAuth 2.0 protocol for [authentication and\nauthorization](https://developers.google.com/identity/protocols/OAuth2). The\nApp Identity API can create OAuth tokens that can be used to assert that the\nsource of a request is the application itself. The\n\nreturns an\naccess token for a scope, or list of scopes. This token can then be set in the\nHTTP headers of a call to identify the calling application.\n\n\u003cbr /\u003e\n\n| **Note:** The [Google API Client Libraries](https://developers.google.com/discovery/libraries) can also manage much of this for you automatically.\n\nNote that the application's identity is represented by the service account name,\nwhich is typically *applicationid@appspot.gserviceaccount.com*. You can get the\nexact value by using the\n\n. For services which offer\nACLs, you can grant the application access by granting this account access.\n\nAsserting identity to third-party services\n------------------------------------------\n\nThe token generated by\n\nonly works against Google services.\nHowever you can use the underlying signing technology to assert the identity of\nyour application to other services. The\n\nwill sign bytes using a\nprivate key unique to your application, and the\n\nwill\nreturn certificates which can be used to validate the signature.\n| **Note:** The certificates may be rotated from time to time, and the method may return multiple certificates. Only certificates that are currently valid are returned; if you store signed messages you will need additional key management in order to verify signatures later.\n\n\u003cbr /\u003e\n\nGetting the default Cloud Storage Bucket name\n---------------------------------------------\n\nEach application can have one default Cloud Storage bucket, which\nincludes\n[5GB of free storage and a free quota for I/O operations](/appengine/docs/quotas#Default_Gcs_Bucket).\n\nTo get the name of the default bucket, you can use the App Identity API. Call\n\n\n."]]