KnpLabs / KnpLabs/php-github-api
Get release asset end in AccessDenied
- 主要语言
- PHP
- 星标
- 2.2k
- 派生
- 587
- PR 合并指标
- 30 天内没有已合并 PR
描述
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.
贡献指南
这个仓库没有索引到贡献指南
调研方向
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.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- api
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100