validate(); /** @var MinecraftAccessKey|null $accessToken */ $accessToken = MinecraftAccessKey::findOne([ 'access_token' => $this->accessToken, 'client_token' => $this->clientToken, ]); if ($accessToken === null) { throw new ForbiddenOperationException('Invalid token.'); } if ($accessToken->account->status === Account::STATUS_BANNED) { throw new ForbiddenOperationException('This account has been suspended.'); } $accessToken->refreshPrimaryKeyValue(); $accessToken->update(); return new AuthenticateData($accessToken); } }