Hi, I try to use the Registration Callback Feature, but when i switch it on and enter the URL of my Script, i get the following Error, when i try to register the user via JS:
It is recommended to use the afterRegister event handler in Cloud Code. This way you can control the format of how the data is passed to an external system and what properties are being passed.
The external registration callback is more than likely will be deprecated and ultimately removed.
Hi Mark,
ok, got it! Will play arround with it. Many thanks and big congrats btw.! I found Backendless yesterday and really like it!! Especially, because itâs so easy to implement! Tried Okta before, but did not really like it.
var http = require(âhttpâ);
var options = {
hostname: âmyhostâ,
port: 80,
path: â/registrationcalback.phpâ,
method: âPOSTâ,
headers: {
âContent-Typeâ: âapplication/jsonâ,
}
};
var req = http.request(options, function(res) {
console.log('Status: â + res.statusCode);
console.log('Headers: â + JSON.stringify(res.headers));
res.setEncoding(âutf8â);
res.on(âdataâ, function (body) { //console.log(âBody: â + body);
});
});
req.on(âerrorâ, function(e) { //console.log(âproblem with request: â + e.message);
});
// write data to request body
req.write(â{âstringâ: âHello, Worldâ}â);
req.end();
});
This code sends a small JSON Object to my host. The Script works 100% - Iâve tested it in my console directly with node.js and it sends the data to my Server, but if I put it in the event handler in Backendless, it does nothing.
The Handler seems to work, because, if I put some wrong code inside, and try to register a user, i get an error message, but when i put a properly working code inside, it seems to not to connect.
Is there anything I have to consider?
Would be great to get some more help with this.
Many thanks in Advance!
Pawel
P.S. in my Script above i replaced the real host with hostname, because the page did not allow me to send the issue with the URL inside.
Hello Pawel
It wonât work because BL has some invocation time, for waiting any async functions you should return promise as handler result and resolve the promise when the request is done otherwise the worker which is processing your code will be destroyed and your request will be terminated before it done.
I can propose you to use Backendless.Request api for any requests, itâs already there.
May I ask one last question? I have seen, that BL gives me the possib ility to send my customised Email Confirmation Mails etc. The only thing I donât like is, that the sender is âBackendlessâ (That could confuse my users).
Is there any possibility to replace this my my host domain? I know,. that this could cause some spam problems. Do you have any experience, how your existing clients are handling this?
Another possibility for me is to use the Callback and handle the confirmation by myself (my server will send the mail), but in this case, I somehow need the access to the confirmation URL.
If you have any proposal, how to solve this problem, I would be very thanksful!
Btw. we will launch our project in ca. 6 weeks and are really happy about BL. We want to use your API for our User registrations, since you guys cover our needs really good and we will for sure switch to the paid version ASAP.
Iâve just set up my SMTP Account for sending the mail, like you sbhowed me. When i click onm SAVE or TEST, i get a positive confirmation, so it seems, that BL likes my SMTP. But, when I register, there is no Confirmation Mail sent (I also checked my SPAM Folder). Anything I could check, or would you say, that something is wrong with my SMTP?