dropbox-php-sdk icon indicating copy to clipboard operation
dropbox-php-sdk copied to clipboard

Not able to get Access Token and redirect_uri mismatch issue

Open singhlovey opened this issue 7 years ago • 0 comments

Hi,

First of all thanks for the Dropbox PHP library.

I have successfully integrated this library and able to login into dropbox. I am able to get state and code in return response.

After getting return response, it gives me below error.

-> {"error_description": "redirect_uri mismatch", "error": "invalid_grant"}

NOTE:- Redirect URL is added under developer section and it is correct but still it gives me an error.

For Example :- Under developer section, I have URL like https://xyz.com/redirect_url.php and in return I am getting https://xyz.com/redirect_url.php?state=""&code="" but still gives me an error and don't know why?

After that I have go through the core library and do some trick and hard coded the redirect url and i.e only https://xyz.com/redirect_url.php without params. it works and proceed further but at the end I am not able to get access token.

  1. Hard Coded the $url inside send function.

File Name :- DropboxGuzzleHttpClient.php Function Name :- send($url, $method, $body, $headers = [], $options = []) {}

  1. Check access token inside getAccessToken function.

File Name :- DropboxAuthHelper.php Function Name :- getAccessToken

$accessToken = $this->getOAuth2Client()->getAccessToken($code, $state, $redirectUri);

I am getting empty in $accessToken.

Please help ASAP and let me know what approach I follow to make it work.

Thanks

singhlovey avatar Mar 23 '18 09:03 singhlovey