Include Authorization Headers in RPC Method Calls
Every time an RPC method executes, it uses the headers to authorize access to resources.
How you set the headers depends on your programming language. In Python, the headers are provided in a tuple as a parameter to each call. For more information, see Python Quick Start for Pub/Sub API. In other languages, such as Java, you can provide the headers in the stub separately before making a gRPC call.
The OAuth access token or the session ID returned in the login()
call response. For more information about getting an OAuth access token, see OAuth Authorization Flows in Salesforce Help. For more information about the login()
call, see login() in the SOAP API Developer Guide.
The first part of your Salesforce server URL without the ending path portion. You can get this URL in one of two ways.
- From the
login()
call result inserverUrl
, as outlined in the quick start example in this guide. For more information, see LoginResult in the SOAP API Developer Guide. - From the result that Salesforce returns as part of the OAuth authorization flow in
instance_url
. For more information, see OAuth 2.0 User-Agent Flow for Desktop or Mobile App Integration in Salesforce Help.
The Salesforce URL can be:
- A MyDomain URL. For example,
https://MyDomainName.my.salesforce.com
. - A custom domain URL. For example,
https://www.example.com
.
An ID that uniquely identifies your org. If you set this header to the org ID, the Pub/Sub API constructs the entire value for you. These values are valid.
{Org ID}
core/{Subdomain}/{Org ID}
Examples:
- Org ID:
00D5e000003TIrB
- Entire value:
core/MyDomainName/00D5e000003TIrB
The org ID is returned in the login() call response. Alternatively, you can get your org ID value by following the steps in Find your Salesforce Organization ID in Salesforce Help.
If you build the entire value, use your org’s My Domain login URL. You can find this value in Setup > My Domain. For more information, see My Domain in Salesforce Help.