As a part of basic authentication, you are required to perform base 64 encoding by writing a pre-hook to convert the value into the base 64 format. You may now skip that step by directly using our expressions. For example, for Insightly we have taken API key as the configuration parameter and are sending it as basic authorization.
- Enter 'Authorization' as the parameter name and set 'Header' as the parameter type.
- Set ‘value’ as the parameter type and enter ‘Basic CE.b64(${configuration.api.key})’ as the value; wherein the configuration parameter is 'api key' and 'Basic' is the type of authentication.
- The expression gets evaluated at the back end and performs base 64 encoding on the API key.
- For example, if the API key is c0a98f8c-7b13-11e9-8f9e-2a86e4085a59, then the Authorization header would look like - Basic YzBhOThmOGMtN2IxMy0xMWU5LThmOWUtMmE4NmU0MDg1YTU5; YzBhOThmOGMtN2IxMy0xMWU5LThmOWUtMmE4NmU0MDg1YTU5 being the base 64 encoded format of the API key.