Bitbucket\API\Teams::repositories() results in HTTP/1.1 401 UNAUTHORIZED

Issue #41 invalid
Davit Barbakadze created an issue

However it starts to work when I change:

public function repositories($name)
    {
        return $this->getClient()->setApiVersion('2.0')->get(
            sprintf('teams/%s/repositories', $name)
        );
    }

to:

public function repositories($name)
    {
        return $this->getClient()->setApiVersion('2.0')->get(
            sprintf('repositories/%s', $name)
        );
    }

Comments (5)

  1. Alexandru Guzinschi

    You need to authenticate and be part of the team in order to work.

    The only way I can reproduce a 401 status code on this endpoint is to use Basic Authentication with wrong credentials.

  2. Davit Barbakadze reporter

    I own the team and the repos. I'm using oAuth. Auth should not be the matter, since I'm able to fetch the (otherwise private) info via second endpoint.

  3. Alexandru Guzinschi

    Probably you are trying to use OAuth1 and that endpoint requires OAuth2 with repositories scope, from what I remember.

    Auth should not be the matter, since I'm able to fetch the (otherwise private) info via second endpoint.

    In theory the second endpoint should enforce OAuth2 also, but if you look at the response headers you will see that OAuth2 scope(s) are included, which makes me think that they are doing some magic in the backend to keep backward compatibility with old (OAuth1 only) clients.

    Anyway, I strongly suggest to use OAuth2 as default authentication method.

  4. Log in to comment