vienthuong / shopware-php-sdk

A PHP SDK for Shopware 6 Admin API
MIT License
112 stars 44 forks source link

Call to a member function getSource() on null #65

Closed nilesh-nitsan closed 1 year ago

nilesh-nitsan commented 1 year ago

PHP v7.4 Shopware v6.4

When I try to get a token using the below methods

$grantType = new ClientCredentialsGrantType($clientId, $clientSecret);
  $adminClient = new AdminAuthenticator($grantType, $shopUrl);
  $accessToken = $adminClient->fetchAccessToken();

I'm getting the issue Call to a member function getSource() on null.

image

I have also tried with a username and password as well. Still, the same issue will generate. Can you please let me know if anyone faced this issue or any solution for it?

Help is very appreciated.

Cheers, Nilesh

vienthuong commented 1 year ago

Hi @nilesh-nitsan Seems it's an error from Shopware app? Could you list all your steps to reproduce it with an example code? And did you try it with PasswordGrantType?

nilesh-nitsan commented 1 year ago

Hi @vienthuong First of all, thank you for the quick answer.

Actually, I have used this SDK in TYPO3 v10 CMS. Basically, I have tried Postman there is my app working well. It will return a response with the access token.

as mentioned above my code snippet, I have used the same way. And yes I have also tried with the PasswordGrantType.

Is it possible this issue is caused by the Guzzle version?

Awaiting for your thoughts :)

Thanks again!

vienthuong commented 1 year ago

Hi @nilesh-nitsan Sorry for the late response, could you provide which exact shopware version and which sdk version you're using?

nilesh-nitsan commented 1 year ago

Hi @vienthuong I'm using Shopware version 6.4 and SDK version latest one.

renickbuettner commented 1 year ago

I can reproduce this error. If happens when the shop url ends with a slash.

silverDuy commented 1 year ago

Hi @nilesh-nitsan , @renickbuettner

I created this https://github.com/vienthuong/shopware-php-sdk/pull/70 to fix this issue.

Thank you for providing helpful information. I appreciate that.

vienthuong commented 1 year ago

Feel free to reopen if you issue still persist