Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get release asset end in AccessDenied #1040

Open
roderm opened this issue Dec 2, 2021 · 0 comments
Open

Get release asset end in AccessDenied #1040

roderm opened this issue Dec 2, 2021 · 0 comments

Comments

@roderm
Copy link

roderm commented Dec 2, 2021

With the GuzzleHTTP\Client it's not possible to load assets as binary, the redirect to https://objects.githubusercontent.com/ returns an error:

$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 );
<Error>
<Code>AccessDenied</Code>
<Message>Multiple auth mechanisms are not allowed; please use either query parameters or an Authorization header</Message>
<Resource>github-production-release-asset-XXXXX</Resource>
</Error>    

With the HttpClient\HttplugClient from Symfony it works:

...
$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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant