source/php/OAuth/OAuthRequests.php
public function accessOAuth()
    {
        if ((!isset($_POST['verifier'])) || (empty($_POST['verifier']))) {
            wp_send_json_error(__('Verifier is missing', 'event-integration'));
        }

        // Skip SSL verification while DEV_MODE is true
        $options = array(
            'ssl' => array(
                'verify_peer' => defined('DEV_MODE') && DEV_MODE === true ? false : true,
                'verify_peer_name' => defined('DEV_MODE') && DEV_MODE === true ? false : true
            )
        );

        $oauthVerifier = $_POST['verifier'];
        $consumerKey = get_option('_event_client');
        $consumerSecret = get_option('_event_secret');

        // Get API base url
        $apiOauthUrl          = get_field('event_api_oauth_url', 'option');
        $url                  = rtrim($apiOauthUrl, '/');
        $accessTokenUrl       = $url."/access";
        $oauthVersion         = "1.0";
        $oauthSignatureMethod = "HMAC-SHA1";
        $nonce                = md5(mt_rand());
        $oauthTimestamp       = time();

        $sigBase = "GET&" . rawurlencode($accessTokenUrl) . "&"
            . rawurlencode("oauth_consumer_key=" . rawurlencode($consumerKey)
            . "&oauth_nonce=" . rawurlencode($nonce)
            . "&oauth_signature_method=" . rawurlencode($oauthSignatureMethod)
            . "&oauth_timestamp=" . rawurlencode($oauthTimestamp)
            . "&oauth_token=" . rawurlencode(get_option('_temp_request_token'))
            . "&oauth_verifier=" . rawurlencode($oauthVerifier)
            . "&oauth_version=" . rawurlencode($oauthVersion));

        $sigKey = rawurlencode($consumerSecret) . "&" . rawurlencode(get_option('_temp_request_token_secret'));
        $oauthSig = base64_encode(hash_hmac("sha1", $sigBase, $sigKey, true));

        $requestUrl = $accessTokenUrl . "?"
            . "oauth_consumer_key=" . rawurlencode($consumerKey)
            . "&oauth_nonce=" . rawurlencode($nonce)
            . "&oauth_signature_method=" . rawurlencode($oauthSignatureMethod)
            . "&oauth_timestamp=" . rawurlencode($oauthTimestamp)
            . "&oauth_token=" . rawurlencode(get_option('_temp_request_token'))
            . "&oauth_verifier=" . rawurlencode($oauthVerifier)
            . "&oauth_version=". rawurlencode($oauthVersion)
            . "&oauth_signature=" . rawurlencode($oauthSig);

        $response = file_get_contents($requestUrl, false, stream_context_create($options));
        // Return error message if request failed
        if ($response === false) {
            wp_send_json_error(__('The verifier you supplied were not correct', 'event-integration'));
        }

        parse_str(trim($response), $values);
        // Save new tokens to db
        update_option('_event_token',  $values["oauth_token"]);
        update_option('_event_token_secret', $values["oauth_token_secret"]);
        update_option('_event_authorized', true);
        // Remove temporary tokens
        delete_option('_temp_request_token');
        delete_option('_temp_request_token_secret');

        wp_send_json_success(__('You are authorized!', 'event-integration'));
    }
public function accessOAuth()
    {
        if ((!isset($_POST['verifier'])) || (empty($_POST['verifier']))) {
            wp_send_json_error(__('Verifier is missing', 'event-integration'));
        }

        // Skip SSL verification while DEV_MODE is true
        $options = array(
            'ssl' => array(
                'verify_peer' => defined('DEV_MODE') && DEV_MODE === true ? false : true,
                'verify_peer_name' => defined('DEV_MODE') && DEV_MODE === true ? false : true
            )
        );

        $oauthVerifier = $_POST['verifier'];
        $consumerKey = get_option('_event_client');
        $consumerSecret = get_option('_event_secret');

        // Get API base url
        $apiOauthUrl          = get_field('event_api_oauth_url', 'option');
        $url                  = rtrim($apiOauthUrl, '/');
        $accessTokenUrl       = $url."/access";
        $oauthVersion         = "1.0";
        $oauthSignatureMethod = "HMAC-SHA1";
        $nonce                = md5(mt_rand());
        $oauthTimestamp       = time();

        $sigBase = "GET&" . rawurlencode($accessTokenUrl) . "&"
            . rawurlencode("oauth_consumer_key=" . rawurlencode($consumerKey)
            . "&oauth_nonce=" . rawurlencode($nonce)
            . "&oauth_signature_method=" . rawurlencode($oauthSignatureMethod)
            . "&oauth_timestamp=" . rawurlencode($oauthTimestamp)
            . "&oauth_token=" . rawurlencode(get_option('_temp_request_token'))
            . "&oauth_verifier=" . rawurlencode($oauthVerifier)
            . "&oauth_version=" . rawurlencode($oauthVersion));

        $sigKey = rawurlencode($consumerSecret) . "&" . rawurlencode(get_option('_temp_request_token_secret'));
        $oauthSig = base64_encode(hash_hmac("sha1", $sigBase, $sigKey, true));

        $requestUrl = $accessTokenUrl . "?"
            . "oauth_consumer_key=" . rawurlencode($consumerKey)
            . "&oauth_nonce=" . rawurlencode($nonce)
            . "&oauth_signature_method=" . rawurlencode($oauthSignatureMethod)
            . "&oauth_timestamp=" . rawurlencode($oauthTimestamp)
            . "&oauth_token=" . rawurlencode(get_option('_temp_request_token'))
            . "&oauth_verifier=" . rawurlencode($oauthVerifier)
            . "&oauth_version=". rawurlencode($oauthVersion)
            . "&oauth_signature=" . rawurlencode($oauthSig);

        $response = file_get_contents($requestUrl, false, stream_context_create($options));
        // Return error message if request failed
        if ($response === false) {
            wp_send_json_error(__('The verifier you supplied were not correct', 'event-integration'));
        }

        parse_str(trim($response), $values);
        // Save new tokens to db
        update_option('_event_token',  $values["oauth_token"]);
        update_option('_event_token_secret', $values["oauth_token_secret"]);
        update_option('_event_authorized', true);
        // Remove temporary tokens
        delete_option('_temp_request_token');
        delete_option('_temp_request_token_secret');

        wp_send_json_success(__('You are authorized!', 'event-integration'));
    }
OAuth1 verification step 3: Request access to API and save returned tokens if succeeded.
@return void