-
Notifications
You must be signed in to change notification settings - Fork 765
Set custom User-Agent for requests #698
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
Comments
This is still very relevant as Apple Signin requires a proper User-Agent to be passed. |
Any updates on this? I'm facing this same issue myself with Basecamp's API. |
Possibly related to or solved through #863 |
(I posted this on the wrong issue, now moved here) The solution I have found, using the Xero provider, is to create my own Guzzle instance outside the provider. So instead of this: $provider = new \Calcinai\OAuth2\Client\Provider\Xero([
'clientId' => 'my-client-id',
'clientSecret' => 'my-client-secret',
]}; I have this: $httpClient = new \GuzzleHttp\Client([
'headers' => [
'User-Agent' => 'My Xero Application name',
],
]);
$provider = new \Calcinai\OAuth2\Client\Provider\Xero([
'clientId' => 'my-client-id',
'clientSecret' => 'my-client-secret',
], [
'httpClient' => $httpClient,
]}; Even though the message is a PSR-7 message that should contain everything, Guzzle still slips in some headers on top of that, and the Note that these header parameters are for Guzzle 7. The format is slightly different on Guzzle 6 (wrapped in a |
I'm using a GenericProvider and when my application attempts to request the access token from my company's SSO, it hits an error that it's been blocked. Upon further investigation with the SSO team, they determined that this is due to the application being hosted in AWS and has a generic User-Agent, GuzzleHTTP/ Curl/ PHP/.
Is there a way to set a custom User-Agent for the getAccessToken request? Looking at getAccessTokenOptions method, looks like you can only set the body and can't change any other headers.
Do I need to make my own provider? Seems a bit heavy to do for just a small thing piece that would useful to be able to customize?
The text was updated successfully, but these errors were encountered: