【发布时间】:2014-02-15 07:17:42
【问题描述】:
我在我的 laravel 应用中实现了一个 OAuth 1.0a 客户端。我想在用户的 Session 中存储临时凭据和访问令牌。
作为一名 POC,我使用 PHP 本机会话构建了我的代码,并使用了 $_SESSION 变量。像魅力一样工作。但是后来,我想移动我的代码并改用 laravel 的 Session 类。这就是我如何意识到 laravel 并没有保存我的会话数据。
这是相关代码的主要部分:
if (Input::get('release_name')) // ask for auth
{
$temporary_credentials = $server->getTemporaryCredentials();
Session::put("temporary_credentials", serialize($temporary_credentials));
$this->customLog(Session::get("temporary_credentials")); // this prints the string representation of my credentials
return $server->authorize($temporary_credentials);
}
else if (Input::get('oauth_token') && Input::get('oauth_verifier')) // got back from provider
{
$this->customLog(Session::get("temporary_credentials"));
// here the Session::get returns null
}
知道为什么我的temporary_credentials 在第二步“无效”了吗?
快速编辑:我正在使用“文件”驱动程序
谢谢!
【问题讨论】:
-
/app/storage/sessions是否具有读取/写入/执行文件的正确权限?
标签: php session laravel laravel-4 session-variables