こんにちは私は初心者で、このライブラリを使用しています php auth 2.0 これはauth 2.0を使用するための良い解決策と思われます。私はそれを受け取ることができるリフレッシュトークンを生成しようとしています。ここに私のコードは次のとおりです。ここでリフレッシュトークン認証を受信していません2.0
OAuth2\Autoloader::register();
// $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhost"
$storage = new OAuth2\Storage\Pdo(array('dsn' => $this->dsn, 'username' => $this->username, 'password' => $this->password));
// Pass a storage object or array of storage objects to the OAuth2 server class
$server = new OAuth2\Server($storage,array('always_issue_new_refresh_token' => true,
'refresh_token_lifetime' => 2419200,));
// Add the "Client Credentials" grant type (it is the simplest of the grant types)
$server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage));
$server->addGrantType(new OAuth2\GrantType\RefreshToken($storage));
はリクエストです:
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,"http://localhost/eventapp/index.php/oauth/handle");
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, "grant_type=client_credentials&client_id=ID&client_secret=SECRET");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result=curl_exec($curl);
curl_close ($curl);
$result=get_object_vars(json_decode($result));
print_r($result);
誰もがこれで私を助けることができますか?私がここで間違っていることを教えてください?
リフレッシュトークンが含まれていますhere
例リクエスト
をご確認ください。そうすれば、例外を監視するのが非常に簡単になります。私は – khakishoiab
@khakishoiabには、私はアプリで実際のIDとシークレットを使用していないのです@khakishoiabタイムアウトの問題 – asfandahmed1
トークンを更新していないアクセストークンを受け付けております – khakishoiab