我在我的应用程序中使用 dropbox php sdk 我正在尝试使用以下代码访问核心 API
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);
});
第一个控制器一切正常,它重定向到 Dropbox 登录页面我填写用户名和密码,然后页面重定向到指定的 uri,我得到以下异常 csrf not found 异常