Hi, I’m unsuccessfully attempting to connect my Wix site to ZohoCRM,
ZohoCRM has a new OAuth2 api and I was hoping for an example of how to use it from Wix.
Note: ZohoCRM has a new package: ‘zcrmsdk’, but this has not been added to the Wix Package manager yet.
Can someone point me towards a generic oauth2 example in Wix, which handles refreshing a token, logging in, and making API calls?
forgot to mention, there is currently a ‘zoho’ package in wix, but the API it calls will be deprecated in 2 weeks, and I couldn’t get it to work (my wix backend code couldn’t find the module)
You can see an example of oath2 in the Example: Google Sheets NPM . You should be able to apply the principles to your use case.
Also, what do you mean that your “backend code couldn’t find the module”? If it was because of the require being flagged in error, don’t worry - it still works.
having a hard time getting this to work. Always get an authentication failure from zoho. I can get it to work in Postman just fine but wix must do something funky with the request. I think it might be a CORS issue but have tried to place a proxy CORS server in the fetch request. Still having issues.
All my fetch requests are being called from the .jsw file like this
export function getRecord(module, RecId){
const proxyurl = “https://mighty-falls-85785.herokuapp.com/”;
let url = “https://www.zohoapis.com/crm/v2/Contacts/1438911000012690348”;
//let url = “https://www.zohoapis.com/crm/v2/“+module+”/”+RecId;
var options = {
method : “GET”,
header : {
“Access-Control-Allow-Headers”: “x-requested-with, x-requested-by”,
“Authorization” : “token here” //may need a ‘Bearer’ or ‘Zoho-oauthtoken’ before token but that still hasn’t worked
}
}
return fetch(url, options)
.then(response => response.json())
.then(json => json);
//“Content-Type” : “application/json”,
}