E
E
Evgeny Ivanovich2019-09-10 05:06:30
Bitbucket
Evgeny Ivanovich, 2019-09-10 05:06:30

How to get content from private bitbucket repository using key:secret pair?

In general, there is a private repository, there is an OAuth user, the task is to get the content of a file from a private repository, the OAuth user has read access to projects.
Request api https://developer.atlassian.com/bitbucket/api/2/re...
Request code

if ($curl = curl_init())
{
    curl_setopt_array($curl, array(
        CURLOPT_URL => <API_PATH>,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_USERPWD, sprintf("%s:%s", self::CLIENT_ID, self::SECRET)
    ));
    
    $response = curl_exec($curl);
    curl_close($curl);
    echo $response;
}

output error
Access denied. You must have write or admin access.

How to be?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question