Skip to content

Commit

Permalink
revert example changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hafezdivandari committed Oct 30, 2024
1 parent 8820f34 commit 1b005d3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions examples/src/Repositories/DeviceCodeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use DateTimeImmutable;
use League\OAuth2\Server\Entities\DeviceCodeEntityInterface;
use League\OAuth2\Server\Repositories\DeviceCodeRepositoryInterface;
use OAuth2ServerExamples\Entities\ClientEntity;
use OAuth2ServerExamples\Entities\DeviceCodeEntity;

class DeviceCodeRepository implements DeviceCodeRepositoryInterface
Expand All @@ -38,12 +39,16 @@ public function persistDeviceCode(DeviceCodeEntityInterface $deviceCodeEntity):
/**
* {@inheritdoc}
*/
public function getDeviceCodeEntityByDeviceCode(string $deviceCode): ?DeviceCodeEntityInterface
public function getDeviceCodeEntityByDeviceCode($deviceCode): ?DeviceCodeEntityInterface
{
$clientEntity = new ClientEntity();
$clientEntity->setIdentifier('myawesomeapp');

$deviceCodeEntity = new DeviceCodeEntity();

$deviceCodeEntity->setLastPolledAt(new DateTimeImmutable());
$deviceCodeEntity->setInterval(5);
$deviceCodeEntity->setIdentifier($deviceCode);
$deviceCodeEntity->setExpiryDateTime(new DateTimeImmutable('now +1 hour'));
$deviceCodeEntity->setClient($clientEntity);

// The user identifier should be set when the user authenticates on the
// OAuth server, along with whether they approved the request
Expand Down

0 comments on commit 1b005d3

Please sign in to comment.