How to use CE functionality for Base 64 conversions

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 CE expressions. For example, for Insightly we have taken api key as the configuration parameter and are sending it as basic authorization.

1. Enter 'Authorization' as the parameter name and set 'Header' as the parameter type.

2. 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.

3. 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.