A Clear Basic Authentication Example in PHP?

I’m looking over the documentation and struggling to find a “working” example.

I’m using php and have the following code using Unirest but all I get are varying errors mostly ending up with a 401. Where am I going wrong?


$token = ‘hellodolly@bingo.com:sometokenhuh’;
$tokenEncoded = base64_encode($token);


$headers = array( ‘Accept’ => ‘application/json’, ‘Content-Type: application/json’, ‘Authorization’ => 'Basic '.$tokenEncoded);

// basic auth

$response = Unirest\Request::get(‘https://wubbalubbadubdub.atlassian.net/rest/api/3/issue/BBB-835’, $headers);


I’m not a real php developer, I just play one on the web.

Just to double check: you are using the new API tokens right? See https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/

meh, I was using the label instead of the actual token.

On, to the next issue.