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

RequestHandler overwrites Client when access token is set #17

Open
nosnickid opened this issue Oct 8, 2023 · 0 comments · May be fixed by #18
Open

RequestHandler overwrites Client when access token is set #17

nosnickid opened this issue Oct 8, 2023 · 0 comments · May be fixed by #18
Labels
bug Something isn't working

Comments

@nosnickid
Copy link

Describe the bug
When setAccessToken is called on the RequestHandler, it stores the token and instantiates a new Client.

If Client has been configured elsewhere and passed to the NordigenClient, the custom config is lost when this happens.

The RequestHandleTrait should instead pass an Authorization header to each request, if one is present

To Reproduce

$client = new GuzzleHttp\Client();
$nordigen = new Nordigen\NordigenPHP\API\NordigenClient($id, $key, $client);
$nordigen->setAccessToken('stored-token');
// now, $nordigen->requestHandler->httpClient is no longer the $client we passed

Expected behavior
$requestHandler->httpClient should be preserved and have an extra Authorization header passed if accessToken is set.

Additional context
I have a PR ready, I'll submit it shortl.

@nosnickid nosnickid added the bug Something isn't working label Oct 8, 2023
@nosnickid nosnickid linked a pull request Oct 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant