tan-tan-kanarek / github-php-client

MIT License
184 stars 120 forks source link

repos->listYourRepositories return all repos, not just mine #15

Closed rafiki270 closed 10 years ago

rafiki270 commented 10 years ago

Do you have an idea what might be wrong, I have checked the CURL and the username and password is being passed on ...

class Github {

private $username = NULL;
private $password = NULL;

private $client = NULL;

public function __construct($username=NULL, $password=NULL) {
    $this->username = $username;
    $this->password = $password;

    $this->client = new GitHubClient();
    $this->client->setCredentials($username, $password);
}

public function listRepos() {
    return $this->client->repos->listYourRepositories();
}
tan-tan-kanarek commented 10 years ago

Can't tell, the same code works for me: require_once(DIR . '/client/GitHubClient.php');

class Github { private $username = NULL; private $password = NULL;

private $client = NULL;

public function __construct($username = NULL, $password = NULL)
{
    $this->username = $username;
    $this->password = $password;

    $this->client = new GitHubClient();
    $this->client->setCredentials($username, $password);
}

public function listRepos()
{
    return $this->client->repos->listYourRepositories();
}

}

$github = new Github('tan-tan-kanarek', '****'); var_dump($github->listRepos());

What is the error you get?

rafiki270 commented 10 years ago

that's the thing ... it returns loads of public repos, not mine ... for example if I do this: curl -u "rafiki270:password" https://api.github.com/orgs/fuerteinternational

I get a full stat on my organisation but if I do it through this class I get only the publicly visible bit so my first thought was that the authentication doesn't work properly?

rafiki270 commented 10 years ago

I get exactly 100 public repos if I do the same thing you did ... well, I did :) ... and I have verier the credential by using CURL directly from the command line ...

tan-tan-kanarek commented 10 years ago

Sorry, you're right. See my fix: https://github.com/tan-tan-kanarek/github-php-client/commit/bf9673f63f0ed3b4ba4efceb823f3a19b189cb18

rafiki270 commented 10 years ago

cheers! :)