thephpleague / oauth2-server

A spec compliant, secure by default PHP OAuth 2.0 Server
https://oauth2.thephpleague.com
MIT License
6.52k stars 1.12k forks source link

Best way to validate account by email #1334

Closed shinnokdisengir closed 1 year ago

shinnokdisengir commented 1 year ago

Hi, I want to validate a subscribed account by email, send him a link like

http://server/validate/{{jwtToken}} using query strings could be fine too http://server/validate/?token={{token}}&client_id={{blabla}}

I understood how to issue a new token, but I'm not sure is the best way, I think I'd better to create a new Grant/AuthorizationValidator.

$accessToken = new AccessTokenEntity();
$accessToken->setClient($this->clientRepository->getClientEntity('test'));
$accessToken->setIdentifier('dottore');
$accessToken->setUserIdentifier($account->username);
$accessToken->setExpiryDateTime(new DateTimeImmutable('+1 hour'));
$accessToken->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../../../private.key'));

Are there some examples? Can you help me? Thanks

Sephster commented 1 year ago

Sorry I think this is a more general OAuth question and is probably better suited to something like Stack Overflow. Apologies I can't be of help in this instance