VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: mhs_pro on January 20, 2019, 18:28:30 PM

Title: How to create vm user by API function
Post by: mhs_pro on January 20, 2019, 18:28:30 PM
Hi
I want create user with API function in vm 3

I checked how a user was register
in public_html/administrator/component/com_virtuemart/models/user.php there is a function named store(&$data).

public function store(&$data){

$message = '';
==> vRequest::vmCheckToken('Invalid Token, while trying to save user');

if(empty($data)){
vmError('Developer notice, no data to store for user');
return false;
}

This function checks vRequest::vmCheckToken

How can I fill out the vRequest?
Title: Re: How to create vm user by API function
Post by: Studio 42 on January 21, 2019, 09:58:24 AM
You need to call 2 times the server to do something secured
First time using JSession::getFormToken(); to get the form field name and you have to set it to 1
Using CURL you need to  send POST datas.
Some explain to get token here : https://docs.joomla.org/How_to_add_CSRF_anti-spoofing_to_forms
You can perhaps set this directly in the server POST datas using Joomla or virtuemart input function.