The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

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.

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 instance URL if MyDomain or a custom domain isn’t set up. For example, https://InstanceName.salesforce.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, 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 MyDomainName in 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 InstanceName in https://InstanceName.salesforce.com.