src/Upwork/API/AuthTypes/AbstractOAuth.php
public function auth()
    {
        ApiDebug::p('running auth process in ' . __CLASS__);

        if (self::$_accessToken === null && self::$_verifier === null) {
            if (self::$_requestToken === null && self::$_requestSecret === null) {
                // web-based application should setup and save request token itself
                // to be able use it after callback
                $this->setupRequestToken();
            }

            $authUrl = ApiUtils::getFullUrl(self::URL_AUTH) .
            '?oauth_token=' . self::$_requestToken;

            if (self::$_mode === 'web') {
                // authorize web application via browser
                header('Location: ' . $authUrl);
            } elseif (self::$_mode === 'nonweb') {
                // authorize nonweb application
                ApiDebug::p('found [nonweb] mode, need to authorize application manually');

                $prompt = 'Visit ' . $authUrl . "\n " .
                    'and provide oauth_verifier for further authorization' . "\n" .
                    '$ ';
                if (PHP_OS == 'WINNT') {
                    echo $prompt;
                    $verifier = stream_get_line(STDIN, 1024, PHP_EOL);
                } else {
                    $verifier = readline($prompt);
                }

                // get access token
                $this->_setupAccessToken($verifier);
            }
        } elseif (self::$_accessToken === null && self::$_verifier !== null) {
            // get access token, web-based callback
            $this->_setupAccessToken(self::$_verifier);
        } else {
            // access_token isset
        }

        return array(
            'access_token'  => self::$_accessToken,
            'access_secret' => self::$_accessSecret
        );
    }
public function auth()
    {
        ApiDebug::p('running auth process in ' . __CLASS__);

        if (self::$_accessToken === null && self::$_verifier === null) {
            if (self::$_requestToken === null && self::$_requestSecret === null) {
                // web-based application should setup and save request token itself
                // to be able use it after callback
                $this->setupRequestToken();
            }

            $authUrl = ApiUtils::getFullUrl(self::URL_AUTH) .
            '?oauth_token=' . self::$_requestToken;

            if (self::$_mode === 'web') {
                // authorize web application via browser
                header('Location: ' . $authUrl);
            } elseif (self::$_mode === 'nonweb') {
                // authorize nonweb application
                ApiDebug::p('found [nonweb] mode, need to authorize application manually');

                $prompt = 'Visit ' . $authUrl . "\n " .
                    'and provide oauth_verifier for further authorization' . "\n" .
                    '$ ';
                if (PHP_OS == 'WINNT') {
                    echo $prompt;
                    $verifier = stream_get_line(STDIN, 1024, PHP_EOL);
                } else {
                    $verifier = readline($prompt);
                }

                // get access token
                $this->_setupAccessToken($verifier);
            }
        } elseif (self::$_accessToken === null && self::$_verifier !== null) {
            // get access token, web-based callback
            $this->_setupAccessToken(self::$_verifier);
        } else {
            // access_token isset
        }

        return array(
            'access_token'  => self::$_accessToken,
            'access_secret' => self::$_accessSecret
        );
    }
Auth process

@access  public
@return  string