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?

require_once(‘vendor/autoload.php’);
require_once(‘vendor/mashape/unirest-php/src/Unirest.php’);

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

//var_dump($tokenEncoded);

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

// basic auth
Unirest\Request::auth(‘hellodolly@bingo.com’,‘sometokenhuh’);

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

var_dump($response);

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.