Acacha\Llum\Github\GithubAPI::getPersonalToken PHP Method

getPersonalToken() public method

Obtain personal token.
public getPersonalToken ( $username, $password ) : mixed
$username
$password
return mixed
    public function getPersonalToken($username, $password)
    {
        $response = $this->client->request('POST', $this->authorization_url(), ["auth" => [$username, $password], "json" => $this->authorizationsRequestJson()]);
        $response = json_decode($response->getBody());
        $this->tokenName = $response->app->name;
        return $response->token;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 public function askGithubToken(InputInterface $input, OutputInterface $output)
 {
     $question = new ConfirmationQuestion('<info>Do you want to use our assistant to obtain token via Github API (Y/n)? </info>', true);
     if ($this->getHelper('question')->ask($input, $output, $question)) {
         $this->github_token = $this->api->getPersonalToken($this->github_username, $this->askGithubPassword($input, $output));
     }
 }