Jump to content

localApi License key is invalid Problem


UgurBurak

Recommended Posts

Hi,

I 'am developing a provisioning module in WHMCS 8.2.0. Create Account function is sending parameters to cron. And cron executing a function in xxxx.php. 

No problem so far. But when i want to update service details with localapi, i'm getting this error. 

Error:

{"result":"error","message":"Your license key is invalid"}

Our license is valid owned license. 

 

image.thumb.png.6af8d5c5f1d5dc99ce6d33d270f2b0d6.pngimage.thumb.png.b65b895a81d8f0be4314ee3485d2c4f1.png

image.thumb.png.fb6591fe62d09ea22a4b3fb930cf08c4.png

 

 

Finally, my service updating code is here.

		$vmid = g_proxmox_explode_field($params['configoption2']);
		$pveusername = g_proxmox_explode_field($params['configoption13']);
		$pvepassword = g_proxmox_explode_field($params['configoption14']);
        $node_name = g_proxmox_explode_field($params['configoption17']);

		$command = 'UpdateClientProduct';
		$postData = array(
			'serviceid' => $params['serviceid'],
			'serviceusername' => $os_username->username,
			'servicepassword' => $selected_password,
			'dedicatedip' => $selected_ip->ip_address,
			'assignedips' => implode(PHP_EOL, $selected_ip_extras),
			'customfields' => base64_encode(
				serialize(
					array(
						$vmid[0] => $generated_vmid,
						$pveusername[0] => $pve_username,
						$pvepassword[0] => $pve_password,
                        $node_name[0] => $node
					)
				)
			)
		);
        $adminUsername = Capsule::table("tbladmins")->where("id", "1")->value('username');
		$results = localAPI($command, $postData, $adminUsername);
		if($results['result'] != 'success'){
			return 'Ürün bilgileri güncellenirken hata oluştu Hata: '.json_encode($results);
		}

 

Edited by UgurBurak
Link to comment
Share on other sites

  • 6 months later...

Remote API access - you mean via external API? If so, there could be problem with checking license because of server IP is different than frontend IP.
When you validating license after reissue or for new installation, you do it via http(s)- so frontend IP is saved.

If your frontend have dedicated IP then it is different from server IP - so running script via console/cron will use server IP and this one will be different from this validated in license. 
In cron/console there is not SERVER_ADDR and SERVER_HOST vars which is using for validation so IP will be get with something similar to this:

gethostbyname(gethostname())

In your solution, you are using curl to connect http(s) (frontend IP is used),  so it works fine because IP is validate correctly.

IMO the best solution for this situation will be additional IP for license - you need to contact with support, but it could be hard way - they saying is not possible (of course it is ;))

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated