Hi,
I am getting an error when using Parse login() function
parse.request( parse.User.login )
:options( { email = ‘ashraf@shokry.net’, password = ‘aa’ } )
:response(cb)
the error is always (username/email is required)
Thank you
Hi,
I am getting an error when using Parse login() function
parse.request( parse.User.login )
:options( { email = ‘ashraf@shokry.net’, password = ‘aa’ } )
:response(cb)
the error is always (username/email is required)
Thank you
Hi,
I have not worked with the Parse plugin for a number of years, so I am not sure what changes may have been made with Parse server. The plugin is open source though, so you are welcome to dig around.
https://bitbucket.org/develephant/corona-plugin-parse
-dev
Hi,
I’ve pushed an update to the Parse plugin that seems to be working with back4app. I’ll let you know when it propagates. Could be an hour or so.
-dev
Hi,
Great, Thank you so much
Hi,
The plugin seems to have propagated. You can check the version with:
print( parse.config.version )
It should output “1.0.0”
I was able to get a successful response from back4app using:
local parse = require('plugin.parse') parse.config:cloudAddress("https://parseapi.back4app.com") parse.config:applicationId("\<application-id\>") parse.config:restApiKey("\<rest-api-key\>") --== Set Debugging Output Modes parse.config:debugEnabled( true ) parse.request( parse.User.login ) :options({username="\<username\>",password="\<password\>"}) :response()
If you want to add the additional “Revocable-Session” header you can do:
parse.request( parse.User.login ) :options({username="\<username\>",password="\<password\>"}) :header("X-Parse-Revocable-Session", "1") :response()
I didn’t test anything beyond the login, but it should work with the other commands. Let me know if they don’t.
Corona Parse Plugin Docs: http://parse-corona-sdk-plugin.readthedocs.io/
-dev
Thank you, Yes I tested the login() and it is working find.
coming few days will test more commands and get back to you.
Thank you for your support
Hi,
I tried to call cloud function
[lua]
parse = require(‘plugin.parse’)
parse.config:cloudAddress(“https://parseapi.back4app.com/”)
parse.config:applicationId(“pGjJHdqCr6NDdMM9WyluDJ1Zu7FG9RV24DgaXacO”)
parse.config:restApiKey(“hTCvQnmZeORefXoHD20maF85uSbG4oxqvnPCQkug”)
local function cb(ok, res, info)
if ok then
print("from getTime = ", res.min)
end
end
parse.request( parse.Cloud.call, “getTime” )
:data()
:response(cb)
[/lua]
but nothing return in res!
from back4app log, it shows
Hi,
What does your Cloud Code look like?
-dev
[lua]
Parse.Cloud.define(“getTime”, function(request, response) {
var moment = require(‘moment’);
var dateToday = new Date();
//console.log(“time” + ms)
var retArr = {“min” : dateToday.getMinutes(), “sec” : dateToday.getSeconds()};
response.success(retArr)
});
[/lua]
Hi,
to run a quere to get objects from “selfie” class with a field “page” a pointer to User class, order by “data” and "createdAt, limit = 5
[lua]
parse.request(parse.Object.query, “selfies”)
:where({ [“delete”] = false,[“page”] ={
["__type"] = “Pointer”,
[“className”] = parse.USER_CLASS,
[“objectId”] = “9tdVNPRyS1”,
}
})
:options({[“order”] = “date,createdAt”, [“limit”] = “5”} )
:response(cb1)
[/lua]
it is not working
Hi,
Make sure to turn on the debugging flag so you can see the object that is returned from Parse:
local parse = require('plugin.parse') parse.config:cloudAddress("https://parseapi.back4app.com") parse.config:applicationId("\<app-id\>") parse.config:restApiKey("\<rest-api-key") --############################################################################# --# Turn on debugging --############################################################################# parse.config:debugEnabled( true )
For Cloud Code the object is in the result key, as shown in the Corona console with debugging on:
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\* Parse RESPONSE @ 06-09 18:35:11 [1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \> result: \> min: 35 \> sec: 11 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* from getTime = 35
So your code should look something like:
local function cb(ok, res, info) if ok then print("from getTime = ", res.result.min) else print(res.error, res.code) end end parse.request( parse.Cloud.call, "getTime" ) :data() :response(cb)
Hope that helps.
-dev
Hi,
Please turn on the debugging flag (see post above) and share the output.
-dev
Hi,
I have this cloud code that gets the User object based on objectId passed as a parameter (me).
[lua]
– client
local function cb1(ok, res, info)
if ok then
print("from friends = ", #res.results)
end
end
parse.request( parse.Cloud.call, “tobeFriend” )
:data({sName = “elena”, me = “9tdVNPRyS1” })
:response(cb1)
[/lua]
cloud code
[lua]
Parse.Cloud.define(“tobeFriend”, function(request, response)
{
var un = request.params.sName;
var userq = new Parse.Query(Parse.User);
userq.equalTo(“objectId”, request.params.me)
userq.find({useMasterKey:true})
.then((results) =>
{
user = results[1];
console.log(results[1].get(“objectId”));
response.success(results[1].get(“objectId”));
})
.catch(() =>
{
response.error(“error” + error.message);
});
});
[/lua]
I am getting nothing, and sometimes
2018-06-11 12:39:08.798 Corona Simulator[2410:813681] ERROR: network: network request failed: https://parseapi.back4app.com//functions/tobeFriend [-1001: The request timed out.]