Hello, how can I restrict the API so GameSparks just uses a couple of parameters I defined before on requests? For example, if someone calls the CreateChallengeRequest he can optionally pass all parameters:
Can I restrict the request server-side and just take something like challengeShortCode, endTime, usersToChallenge and ignore the rest? Because it is a security vulnerability, if the client can send more stuff, than I need.
It would be possible with using Cloud Code, but then I get some problems with calling LogEvents without authentication.
Best Answer
C
Customer Support
said
almost 6 years ago
Hey David,
A lot of those attributes are not actually required for the request to run properly. You can check out what is needed in the API doc here. If you want to completely remove those attributes, you could create your own custom request (LogEventRequest) and call the original CreateChallengeRequest from that event.
Something like this...
var req = new SparkRequests.CreateChallengeRequest(); req.challengeShortCode = "xyz"; req.endTime = new Date(); req.usersToChallenge = []; var resp = req.SendAs(Spark.getPlayer().getPlayerId());
Let me know if that answers your question. Thanks, Sean
This is not possible server-side unfortunately, the request parameters can only be restricted by the client-side interface.
Yes, you could call a LogEvent that would embed the CreateChallengeRequest inside of it. This requires authentication, however, so too does the regular CreateChallengeRequest. Have you been having problems trying to do this?
-Pádraig
Customer Support
said
almost 6 years ago
Answer
Hey David,
A lot of those attributes are not actually required for the request to run properly. You can check out what is needed in the API doc here. If you want to completely remove those attributes, you could create your own custom request (LogEventRequest) and call the original CreateChallengeRequest from that event.
Something like this...
var req = new SparkRequests.CreateChallengeRequest(); req.challengeShortCode = "xyz"; req.endTime = new Date(); req.usersToChallenge = []; var resp = req.SendAs(Spark.getPlayer().getPlayerId());
Let me know if that answers your question. Thanks, Sean
D
David Bochan
said
almost 6 years ago
Hey Pádraig & Sean,
yep, that's what I was thinking about. There was no problem to restrict a CreateChallengeRequest with a LogEventRequest, but it is impossible to restrict something like a RegistrationRequest or a DeviceAuthenticationRequest with a LogEventRequest, right? Because I'm not able to call LogEventRequests when not authenticated.
I think we will start to authenticate every player first through his device and then optionally through Google/FB - that should solve the problem.
Customer Support
said
almost 6 years ago
Hey David,
Yes, this should work for you, a lot of our customers will preform a device-auth to get info before using social authentication. Let us know if you have any more questions.
David Bochan
Hello, how can I restrict the API so GameSparks just uses a couple of parameters I defined before on requests? For example, if someone calls the CreateChallengeRequest he can optionally pass all parameters:
Can I restrict the request server-side and just take something like challengeShortCode, endTime, usersToChallenge and ignore the rest? Because it is a security vulnerability, if the client can send more stuff, than I need.
It would be possible with using Cloud Code, but then I get some problems with calling LogEvents without authentication.
Hey David,
A lot of those attributes are not actually required for the request to run properly. You can check out what is needed in the API doc here.
If you want to completely remove those attributes, you could create your own custom request (LogEventRequest) and call the original CreateChallengeRequest from that event.
Something like this...
var req = new SparkRequests.CreateChallengeRequest();
req.challengeShortCode = "xyz";
req.endTime = new Date();
req.usersToChallenge = [];
var resp = req.SendAs(Spark.getPlayer().getPlayerId());
Let me know if that answers your question.
Thanks,
Sean
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi David,
This is not possible server-side unfortunately, the request parameters can only be restricted by the client-side interface.
Yes, you could call a LogEvent that would embed the CreateChallengeRequest inside of it. This requires authentication, however, so too does the regular CreateChallengeRequest. Have you been having problems trying to do this?
-Pádraig
Customer Support
Hey David,
A lot of those attributes are not actually required for the request to run properly. You can check out what is needed in the API doc here.
If you want to completely remove those attributes, you could create your own custom request (LogEventRequest) and call the original CreateChallengeRequest from that event.
Something like this...
var req = new SparkRequests.CreateChallengeRequest();
req.challengeShortCode = "xyz";
req.endTime = new Date();
req.usersToChallenge = [];
var resp = req.SendAs(Spark.getPlayer().getPlayerId());
Let me know if that answers your question.
Thanks,
Sean
David Bochan
Customer Support
Yes, this should work for you, a lot of our customers will preform a device-auth to get info before using social authentication.
Let us know if you have any more questions.
Sean
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics