KnpLabs / KnpLabs/php-github-api
Get release asset end in AccessDenied
- Vorherrschende Sprache
- PHP
- Sterne
- 2.2k
- Forks
- 587
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- php
- Bereich
- api
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100