- changed component to BB-API 2.0
Bitbucket\API\Teams::repositories() results in HTTP/1.1 401 UNAUTHORIZED
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)
-
-
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.
-
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.
-
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.
-
- changed status to invalid
If you still encounter problems, feel free to open a new issue.
- Log in to comment