当使用这样的URL(客户端凭证交付式)的访问令牌问:获取刷新令牌FOSOAuthServerBundle
http://api.local/app_dev.php/oauth/v2/token?client_id=<client_id>&client_secret=<secret>&grant_type=client_credentials
我得到以下JSON响应:
{
access_token: "XXXXXXXXXXX",
expires_in: 3600,
token_type: "bearer",
scope: "user"
}
刷新令牌缺失,任何想法为什么这可能是?
我FOSOAuthServerBundle在config.yml:
fos_oauth_server:
db_driver: orm
client_class: Acme\ApiBundle\Entity\Client
access_token_class: Acme\ApiBundle\Entity\AccessToken
refresh_token_class: Acme\ApiBundle\Entity\RefreshToken
auth_code_class: Acme\ApiBundle\Entity\AuthCode
service:
user_provider: platform.user.provider
options:
supported_scopes: user
UPDATE
的客户实体使得父实体的构造函数的调用(位于FOSOAuthServerBundle):
namespace Acme\ApiBundle\Entity;
use FOS\OAuthServerBundle\Entity\Client as BaseClient;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class Client extends BaseClient
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
public function __construct()
{
parent::__construct();
}
}
我已经更新了有关客户实体的信息。 – rfc1484 2015-02-10 15:26:29
我的意思是在数据库中,检查你的客户端表,你正在使用的ID,列allowed_grant_types(一个序列化数组),包含refresh_token? – 2015-02-10 15:44:07
它存在于序列化数组中,但它的值为空。 – rfc1484 2015-02-10 16:13:56