getHeaders Method

Rok Kovač
Rok Kovač
  • Updated

When setting up authentication for Custom Actions, you can select to use credentials of an existing synapse. In order to make this work you need to configure the getHeaders method that returns a dictionary of headers that include credentials. Method will not receive any arguments and is only expected to return the dict.

2022-01-21_16-58-02__1_.jpg

getHeaders can access the persisting connection object, allowing you to retrieve any stored credentials from the authConfig object. Please note that the method currently only supports credentials passed in headers.

If the end system sends credentials in the URL, you will need to use the Service Credentials Tokens (find more information in our article: Service Credentials Tokens).

Example Code

def getHeaders(self) -> dict[str, str]:
    return {'Authorization': f'Bearer {self.connection.authConfig.accessToken}'}

 

 

 

Share this

Was this article helpful?

0 out of 0 found this helpful