Closed snehakale47 closed 2 years ago
Hi @snehakale47 what parameters are you passing into the getAccessToken function? If it's the first time in, the grant_type should be authorization_code, if you are refreshing an existing token, grant_type should be refresh_token, and you should be submitting your refresh_token to get a new Access Token. To obtain a refresh_token initially, you need to ensure you have the scope offline_access added in.
Closing this for now as it seems to have been resolved per the above. Please reopen if this continues to be an issue
Im getting the following error while using https://github.com/XeroAPI/xero-php-oauth2#authorizedResource.php code
Fatal error: Uncaught BadMethodCallException: Required parameter not passed: "refresh_token" in /composer/vendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php:35 Stack trace: #0 /composer/vendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php(53): League\OAuth2\Client\Grant\AbstractGrant->checkRequiredParameter('refresh_token', Array) #1 /composer/vendor/league/oauth2-client/src/Grant/AbstractGrant.php(76): League\OAuth2\Client\Grant\AbstractGrant->checkRequiredParameters(Array, Array) #2 /composer/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(535): League\OAuth2\Client\Grant\AbstractGrant->prepareRequestParameters(Array, Array) #3 /xero/authorizedResource.php(34): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object(League\OAuth2\Client\Grant\RefreshToken), Array) #4 {main} thrown in /composer/vendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php on line 35.
Could you please help us to solve that error?