setName('oauth:client:create') ->setDescription('Create OAuht client') ->setHelp('This command allows you to create an OAuth client') ; } /** * @param InputInterface $input * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { $clientManager = $this->getContainer()->get('fos_oauth_server.client_manager.default'); $client = $clientManager->createClient(); $client->setRedirectUris(array('http://127.0.0.1')); $client->setAllowedGrantTypes(array('password', 'token', 'authorization_code')); $clientManager->updateClient($client); $output->writeln('OAuth client successfully generated!'); $output->writeln('client_id: '.$client->getPublicId()); $output->writeln('client_secret: '.$client->getSecret()); } }