KnpLabs / KnpLabs/php-github-api

Get release asset end in AccessDenied

Abierto
#1,040 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
PHP
Estrellas
2.2k
Forks
587
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
php
Área
api
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.