Dear forum members, I am absolutely new with WIX and CORVID and I am not a programmer. I have a problem which I could not solve by myself, for which I would appreciate your help very much. My target is to get an “MD5-Hash” (=Licencekey) for a given Input (=ProductKeyInput) in my web-page. The “MD5-Hash” can be get by an 3 party API (URL). I have already managed this target by myself with the following code (at page level) which works fine:
import { getJSON } from ‘wix-fetch’ ;
$w.onReady( function () {
// page related code here…
$w( ‘#UpdateLicenceKeyButton’ ).onClick((event) => {
DetermineLicenceKey();
})
}
);
function DetermineLicenceKey() {
const url = “ https://helloacm,com/api/md5/?cached&s=" ;
let salt = “Salz”
let ProductKeyInput = $w( “#PRODUCTKEY” ).value;
let fullUrl = url + ProductKeyInput + salt;
getJSON(fullUrl)
.then(Licencekey => {$w( “#LICENCEKEY” ).value=Licencekey;})
}
But my solution is not fulfilling the security aspects at all. I need the determination of the “MD5-Hash”(=Licencekey) in the backend, for a provided input in the front end. Unfortunately I could not solve this problem by myself. In the following I am showing you my backend and frontend codes. My solution is ending with the error “Unexpected token < in JSON at position 0”.
// backend/…
import {fetch} from ‘wix-fetch’ ;
export function LicenceKey(ProductKey) {
const url = “https://helloacm,com/api/md5/?cached&s=” ;
const salt = “salz” ;
let fullUrl = url + ProductKey + salt;
fetch(fullUrl, {method: ‘get’ })
.then(response => response.json()) // response.text() or response.json()?
}
//Frontend page code
import {LicenceKey} from ‘backend/aModule-3’ ;
export function buttonFetchLKEY_click(event) {
LicenceKey($w( “#textInputProductKey” ).value)
.then(result => $w( “#textBox1” ).value = result);
}