KnpLabs / KnpLabs/php-github-api

Get release asset end in AccessDenied

Aberta
#1,040 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
PHP
Estrelas
2.2k
Forks
587
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

With the GuzzleHTTP\Client it's not possible to load assets as binary, the redirect to https://objects.githubusercontent.com/ returns an error:
```php
$token = 'example';
$client = Client::createWithHttpClient( new \GuzzleHttp\Client() );
$client->authenticate( $token, Client::AUTH_ACCESS_TOKEN );
$content = $this->client->repo()->releases()->assets()->show( $username, $name, $assetId, true );
$temp = tempnam( sys_get_temp_dir(), 'TMP_' );
file_put_contents( $temp, $content );
```
```xml

AccessDenied
Multiple auth mechanisms are not allowed; please use either query parameters or an Authorization header
github-production-release-asset-XXXXX

```
With the HttpClient\HttplugClient from Symfony it works:
```php
...
$client = Client::createWithHttpClient( new \Symfony\Component\HttpClient\HttplugClient() );
$client->authenticate( $token, Client::AUTH_ACCESS_TOKEN );
...
```
The redirect-plugin uses the same client which appends the Authorization-header to the request, but the redirect-URL already contains query-parameter for authentication.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

Start by tracing releases()->assets()->show(..., true) through the redirect handling used with GuzzleHttp\Client, comparing it with Symfony's HttplugClient. Reproduce the redirect to objects.githubusercontent.com and verify that the release asset downloads without sending both the Authorization header and query authentication parameters.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
php
Domínio
api
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.