SAP Business One Service Layer encode basic authorization

Because the OData data connection does not allow parameters like $select, we want to consume the SBO service layer as a REST API. But because the cookie cannot be preserved, we need to add the basic authorization to each call. Does anyone know how to achieve this? I understand that the header value needs to be encoded, but don’t know how.

Username is {CompanyDB:“database”, UserName:“user”} so I guess we need to use the ENCODE_BAS64 function to do this, but how should the username and password be represented in the string pased to the ENCODE function? Have tried any possible combination (I think)