3

I am using dropbox php sdk form my app i am trying to access core API using following code

function getWebAuth()
{

$appInfo = dbx\AppInfo::loadFromJsonFile("../dropbox.json");
$clientIdentifier = "My-demo-app/1.0";
$redirectUri = "http://localhost/demo.app/public/dropbox-finish-oauth";
$csrfTokenStore = new dbx\ArrayEntryStore($_SESSION, 'dropbox-auth-csrf-token');
return new dbx\WebAuth($appInfo, $clientIdentifier, $redirectUri,$csrfTokenStore);

}

//My controller => http:://localhost/demo.app/public/dropbox

Route::get('dropbox',function(){

$authorizeUrl = getWebAuth()->start();

return Redirect::to($authorizeUrl);

});

//dropbox redirect uri

Route::get('dropbox-finish-oauth',function(){

  list($accessToken, $userId, $urlState) = getWebAuth()->finish($_GET);

});

Everything is fine in first controller it redirects to dropbox login page i fill in username and password and then page is redirect to specified uri and i get following exception csrf not found exception

user2373881
  • 119
  • 1
  • 2
  • 10

1 Answers1

5

Just a guess, but make sure you're doing session_start() somewhere (on every page load).

If that's not it, perhaps the next step in debugging would be to manually set a session variable and read it back out on another page to verify that session storage is working.

user94559
  • 59,196
  • 6
  • 103
  • 103
  • tat worked i just set session_start() in getWebAuth() function huh i just spent 3 hrs debugging this . i did everything except putting session_start in that function. thanks man – user2373881 Dec 22 '13 at 19:32