Sign In Register

How can we help you today?

Start a new topic
Answered

How do I make events that cannot be accessed by the client?

Basically, I am using one event to initiate another on the server side and it shouldn't be accessed by the client directly.


Best Answer
Hey Paavo.

What you could do is remove those requests from the device-credential.
If you go to the credentials list in your portal you'll see there are a few already setup. Unless you change something your client SDK should be set to 'device' by default.

image



If you click on the toggle marked "Configure request types that this credential can make? By default, all request types except admin requests can be made."

You'll see a list off all event that this credential has access to.
From there you can turn on/off whichever ones you want.

Hope that helps,
Thanks,
Sean

 


Hi Paavo,


Is this an event that you want to completely lock out players from ever sending ? We have an example project that might be of use to you, basically you can assign roles to the users in your game and set which events each role will have access to. So in your case here you could set this event to Admin only so regular players wouldn't be able to use it. If this sounds like it might be useful to you let me know and i'll add you to the project.


Thanks,

Liam



That is right, Sean.
It's currently setup like this

 

var response = Spark.sendRequest({
 "@class": ".LogEventRequest",
 "eventKey": "LeaderboardScoreSubmit",
 "score": Spark.getData().score,
 "period": getTimePeriod()
});

 

 In this example I am submitting leaderboard data so as I am aware it needs to be LogEventRequest. "period" is then populated by the server.


If it gets complitated I think I can live with the current solution (as long as it is not possible to query for a list available events by the client?). I was just trying to hide it since clients is not supposed to access it directly and thought that there might be a simple way to do it.

Answer
Hey Paavo.

What you could do is remove those requests from the device-credential.
If you go to the credentials list in your portal you'll see there are a few already setup. Unless you change something your client SDK should be set to 'device' by default.

image



If you click on the toggle marked "Configure request types that this credential can make? By default, all request types except admin requests can be made."

You'll see a list off all event that this credential has access to.
From there you can turn on/off whichever ones you want.

Hope that helps,
Thanks,
Sean

 

Login to post a comment