src/OauthClient/Oauth2Client.php
public function authorize()
    {
        $this->validateAuthParams();
        try {
            $response = $this->curl->setOption(
                CURLOPT_POSTFIELDS,
                http_build_query(array(
                    'grant_type' => self::GRANT_TYPE_AUTHORIZATION_CODE,
                    'client_id' => $this->clientId,
                    'client_secret' => $this->clientSecret,
                    'response_type' => self::RESPONSE_TYPE_CODE,
                    'state' => self::STATE_ALIVE
                ))
            )->post($this->authUrl, false);
        } catch (InvalidParamException $invalidParamException) {
            throw new Oauth2ClientException($invalidParamException->getMessage());
        }
        return $this->handleAuthorizeResponse($response);
    }
public function authorize()
    {
        $this->validateAuthParams();
        try {
            $response = $this->curl->setOption(
                CURLOPT_POSTFIELDS,
                http_build_query(array(
                    'grant_type' => self::GRANT_TYPE_AUTHORIZATION_CODE,
                    'client_id' => $this->clientId,
                    'client_secret' => $this->clientSecret,
                    'response_type' => self::RESPONSE_TYPE_CODE,
                    'state' => self::STATE_ALIVE
                ))
            )->post($this->authUrl, false);
        } catch (InvalidParamException $invalidParamException) {
            throw new Oauth2ClientException($invalidParamException->getMessage());
        }
        return $this->handleAuthorizeResponse($response);
    }
Authorizes and returns authorization code
@author Adegoke Obasa <goke@cottacush.com>
@return mixed code
@throws Oauth2ClientException
@throws InvalidParamException