TheWebSolver / tws-license-manager-client

The Web Solver License Manager Client extends the functionality of License Manager for WooCommerce. This plugin/framework is to be included inside the selling plugin for license activation/deactivation.
https://github.com/TheWebSolver/tws-license-manager-client
GNU General Public License v3.0
6 stars 2 forks source link

Client activation #6

Closed DesignInvento closed 3 years ago

DesignInvento commented 3 years ago

Hello Mate, Thank you for developing this awesome stuff, While integration, i am getting error message on activation Request was made outside of license form.

please have a look at result output

object(WP_Error)#1702 (3) { ["errors"]=> array(1) { ["license_server_error"]=> array(1) { [0]=> string(41) "Request was made outside of license form." } }

test validation is working fine with debug on.

DesignInvento commented 3 years ago

issue found in server api manager line number 228 system will trough an error if form state is not validate, so it would block activation

// Request is not being sent from license form (except validation), $request => WP_Error.
        if (
            ( 'validate' !== $state ) &&
            // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode
            ( 'TWS' !== $auth_type || base64_decode( $auth_val ) !== $this->hash )
        ) {
            return $this->request_error( __( 'Request was made outside of license form.', 'tws-license-manager-server' ), 401 );
        }
hsehszroc commented 3 years ago

Hey @DesignInvento,

Thank you for trying out this plugin. Could you please show the full code used to start the client manager (codes you implemented as shown in CLIENT.md file).

I think the issue is caused because of missing hash_with() method.

DesignInvento commented 3 years ago

Hi Thank you for getting back, i have/jad followed the client.md instructions, and same start method beinf used,

public function start() {
        //echo $this->manager->validate_with()->authenticate_with()->hash_with
        $this->manager
        ->validate_with(
            array(
                'license_key' => __( 'Enter a valid license key.', 'tws-license-manager-client' ),
                'email'       => __( 'Enter valid/same email address used at the time of purchase.', 'tws-license-manager-client' ),
                'order_id'    => __( 'Enter same/valid purchase order ID.', 'tws-license-manager-client' ),
                //'slug'        => '',
            )
        )
        ->authenticate_with(
            'ck_093706f4c221e7543c7be916218dcd181bcb6f56',
            'cs_02ab8e62e0d5a9199c7d659dc356044ac04972a7',
        )
        ->hash_with( 'server-secret-key' )
        ->connect_with(
            esc_url( self::SERVER_URL ),
            array(
                'timeout'           => 15,
                'namespace'         => 'lmfwc',
                'version'           => 'v2',
                'verify_ssl'        => 2,
                'query_string_auth' => true,
            )
        )
        ->disable_form( true );
    }
hsehszroc commented 3 years ago

I can see that you have not added your own secret key and used the default placeholder text instead. Please follow below instructions and check if it works?

DesignInvento commented 3 years ago

ok Thank you for clarification hash_with( 'server-secret-key' ) was not elaborated well in CLIENT.md please reconfirm may i use LMFWC_PLUGIN_SECRET in hash_with or consumer_secret generated in license manager?

hsehszroc commented 3 years ago

You must use LMFWC_PLUGIN_SECRET constant value in this case.

DesignInvento commented 3 years ago

that's great, would provide feedback, i am palying around the script, have some other issues may needs to implement some checks if in case of activated key removed from server and new license key provided, would be back for further queries. Thank you

hsehszroc commented 3 years ago

Sure 🙂

If the current issue is not resolved, please reply. Otherwise, this issue will be assumed resolved and will be closed tomorrow.

Thank you for using this plugin.