Create a new personal access client.

@param  \MoeenBasra\LaravelPassportMongoDB\ClientRepository  $clients
@return void
508802
protected function createPersonalClient(ClientRepository $clients)
    {
        $name = $this->option('name') ?: $this->ask(
            'What should we name the personal access client?',
            config('app.name').' Personal Access Client'
        );

        $client = $clients->createPersonalAccessClient(
            null, $name, 'http://localhost'
        );

        $accessClient = new PersonalAccessClient();
        $accessClient->client_id = $client->_id;
        $accessClient->save();

        $this->info('Personal access client created successfully.');
        $this->line('<comment>Client ID:</comment> '.$client->_id);
        $this->line('<comment>Client Secret:</comment> '.$client->secret);
    }
1049906
public function create(ClientInterface $client): ClientInterface
    {
        try {
            $now    = $this->ignoreException(function (): DateTimeImmutable {
                return new DateTimeImmutable();
            });
            $schema = $this->getDatabaseSchema();
            $values = [
                $schema->getClientsIdentityColumn()               => $client->getIdentifier(),
                $schema->getClientsNameColumn()                   => $client->getName(),
                $schema->getClientsDescriptionColumn()            => $client->getDescription(),
                $schema->getClientsCredentialsColumn()            => $client->getCredentials(),
                $schema->getClientsIsConfidentialColumn()         => $client->isConfidential(),
                $schema->getClientsIsScopeExcessAllowedColumn()   => $client->isScopeExcessAllowed(),
                $schema->getClientsIsUseDefaultScopeColumn()      => $client->isUseDefaultScopesOnEmptyRequest(),
                $schema->getClientsIsCodeGrantEnabledColumn()     => $client->isCodeGrantEnabled(),
                $schema->getClientsIsImplicitGrantEnabledColumn() => $client->isImplicitGrantEnabled(),
                $schema->getClientsIsPasswordGrantEnabledColumn() => $client->isPasswordGrantEnabled(),
                $schema->getClientsIsClientGrantEnabledColumn()   => $client->isClientGrantEnabled(),
                $schema->getClientsIsRefreshGrantEnabledColumn()  => $client->isRefreshGrantEnabled(),
                $schema->getClientsCreatedAtColumn()              => $now,
            ];

            $identifier = $client->getIdentifier();
            if (empty($scopeIdentifiers = $client->getScopeIdentifiers()) === true) {
                $this->createResource($values);
            } else {
                $this->inTransaction(function () use ($identifier, $values, $scopeIdentifiers) {
                    $this->createResource($values);
                    $this->bindScopeIdentifiers($identifier, $scopeIdentifiers);
                });
            }
            $client->setCreatedAt($now);

            return $client;
        } catch (RepositoryException $exception) {
            $message = 'Client creation failed.';
            throw new RepositoryException($message, 0, $exception);
        }
    }
937057
public function updateClientSecret($clientId, $clientSecret)
    {
        ValidationUtility::ensureStringOrInteger('$clientId', $clientId);
        ValidationUtility::ensureString('$clientSecret', $clientSecret);

        $request = new ClientSecretUpdateRequest();
        $request->setClientSecret($clientSecret);

        return $this->callServicePostApi(
            '\Authlete\Dto\ClientSecretUpdateResponse::fromJson',
            self::$CLIENT_SECRET_UPDATE_API_PATH . $clientId,
            null, $request);
    }
1345313
protected function setClient(Client $client = null)
    {
        if (is_null($client)) {
            $this->httpClient = $this->createHttpClient();
        } else {
            $this->httpClient = $client;
        }
    }
569788
public function detectClient($clients)
	{
		$args = isset($_SERVER['argv']) ? $_SERVER['argv'] : null;

		return $this['client'] = with(new ClientDetector($this['request']))->detect($clients, $args);
	}
1252037
public function add(ClientInterface $client)
    {
        $this->clients[$client->getClientType()][$client->getClientIdentifier()] = $client;

        return $this;
    }
1135831
protected function createResourceFromClient(ClientEntity $client)
    {
        $resource = new Resource(
            $this->generateReadUrl($client->getId()),
            array(
                 'id'           => $client->getId(),
                 'publicId'     => $client->getPublicId(),
                 'secret'       => $client->getSecret(),
                 'redirectUris' => $client->getRedirectUris(),
                 'grants'       => $client->getAllowedGrantTypes(),
            )
        );

        return $resource;
    }
1345133
private function updateClientAccessToken()
    {
        $user = $this->securityContext->getToken()->getUser();
        $this->client->updateAccessToken($user->getAccessToken());
    }
172894
public function create($userId, $name, $redirect, $personalAccess = false, $password = false)
    {
        $client = Passport::client()->forceFill([
            'user_id' => $userId,
            'name' => $name,
            'secret' => Str::random(40),
            'redirect' => $redirect,
            'personal_access_client' => $personalAccess,
            'password_client' => $password,
            'revoked' => false,
        ]);

        $client->save();

        return $client;
    }
461670
public function createCredentials(ClientCredentials $client)
    {
        return $this->createCommand()
            ->setRequest($this->client->post('credentials'))
            ->setBodyEntity($client, 'json')
            ->setResponseClass('Maba\OAuthCommerceInternalClient\Entity\ClientCredentials')
        ;
    }
198102
protected function configureAndRegisterClient(): void
    {
        $this->app->singleton(static::$abstract, function () {
            $basePath = base_path();
            $userConfig = $this->app['config'][static::$abstract];

            // We do not want this setting to hit our main client because it's Laravel specific
            unset(
                $userConfig['breadcrumbs'],
                // this is kept for backwards compatibilty and can be dropped in a breaking release
                $userConfig['breadcrumbs.sql_bindings']
            );

            $options = \array_merge(
                [
                    'environment' => $this->app->environment(),
                    'prefixes' => [$basePath],
                    'project_root' => $basePath,
                    'in_app_exclude' => [$basePath . '/vendor'],
                    'integrations' => [new Integration],
                ],
                $userConfig
            );

            $clientBuilder = ClientBuilder::create($options);
            $clientBuilder->setSdkIdentifier(Version::SDK_IDENTIFIER);
            $clientBuilder->setSdkVersion(Version::SDK_VERSION);

            Hub::setCurrent(new Hub($clientBuilder->getClient()));

            return Hub::getCurrent();
        });
    }
805980
public function create($name, CredentialsInterface $credentials, StorageInterface $storage, $scopes = [], $baseApiUri = null, $apiVersion = null)
    {
      $name = ucfirst($name);

      if(is_null($this->client))
        $this->client = new CurlClient();

      $class = '\\LibX\OAuth2\\Service\\' . $name;

      if(!class_exists($class))
        throw new \Exception('Service with name ' . $name . ' not found');

      return new $class($credentials, $this->client, $storage, $scopes, $baseApiUri);
    }
1035719
public function createClient()
	{
		$client = ClientBuilder::fromConfig($this->environment->all());

		$this->setClient($client);
	}
832246
public function createPersonalAccessClient($userId, $name, $redirect)
    {
        return tap($this->create($userId, $name, $redirect, true), function ($client) {
            $accessClient = Passport::personalAccessClient();
            $accessClient->client_id = $client->id;
            $accessClient->save();
        });
    }
269678
protected function setClient($clientOptions = [])
    {
        $this->createClient($clientOptions);
        $this->consumer = new GuzzleClient($this->client, $this->description);

        return $this;
    }
401812
public function changeClientPassword($client, $password)
    {
        return $this->api->changeClientPassword($this->getClientId($client), $password);
    }
1232996
protected function makeServicesClient(Client $client)
    {
        $parameters = $this->getDescription();

        $description = new Description($parameters);

        return new GuzzleClient($client, $description);
    }