Store creation date
This commit is contained in:
parent
0f4920dca8
commit
cfb9b73205
|
@ -28,6 +28,7 @@ use Friendica\Database\Database;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
require_once __DIR__ . '/../../include/api.php';
|
||||
|
||||
|
@ -218,7 +219,7 @@ class BaseApi extends BaseModule
|
|||
$code = bin2hex(openssl_random_pseudo_bytes(32));
|
||||
$access_token = bin2hex(openssl_random_pseudo_bytes(32));
|
||||
|
||||
$fields = ['application-id' => $application['id'], 'uid' => $uid, 'code' => $code, 'access_token' => $access_token];
|
||||
$fields = ['application-id' => $application['id'], 'uid' => $uid, 'code' => $code, 'access_token' => $access_token, 'created_at' => DateTimeFormat::utcNow(DateTimeFormat::MYSQL)];
|
||||
if (!DBA::insert('application-token', $fields, Database::INSERT_UPDATE)) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ class Token extends BaseApi
|
|||
DI::mstdnError()->RecordNotFound();
|
||||
}
|
||||
|
||||
System::jsonExit(['access_token' => $token['access_token'], 'token_type' => 'Bearer', 'scope' => $application['scopes']]);
|
||||
// @todo Use entity class
|
||||
System::jsonExit(['access_token' => $token['access_token'], 'token_type' => 'Bearer', 'scope' => $application['scopes'], 'created_at' => $token['created_at']]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue