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 using one of these two ways.
- From the
login()call result in
serverUrl, 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,
- A custom domain URL. For example,
- An instance URL if MyDomain or a custom domain isn’t set up. For example,
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:
- Entire value:
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, get the subdomain. The subdomain is one of the following:
- If My Domain is set up, the name of My Domain. For example, it’s
https://MyDomainName.my.salesforce.com. For more information, see What Is My Domain? in Salesforce Help.
- If My Domain isn’t set up, the instance name. For example, it’s