OAuth with PHP: how to convert to base64 correctly

Hey there, I’m hoping this is a simple question and answer. I’ve been slogging through the docs on how to setup Oauth (I’ve successfully managed to get JWT working) but when it gets to the part of:

Authorization The string “Basic” with your Client ID and Client Secret with a colon : in between, Base64 Encoded. For example, Client_ID:Client_Secret Base64 Encoded is Q2xpZW50X0lEOkNsaWVudF9TZWNyZXQ= .

I’m finding the docs very vague. There is no part that tells me how to do this. Nothing I’ve tried has worked. Does anyone have a php example of how to setup the correct header for requesting a token?


Hey @cutlernj,

Here is an example I found from the PHP docs:

$authString = 'Client_ID:Client_Secret';
echo base64_encode($authString);