question

Crazed Pyro avatar image
Crazed Pyro asked

CloudScript error with AuthenticateSessionTicket

Hello,

I was attempting to make a simple CloudScript function to verify a session ticket and return the results. However apparently this provides invalid arguments? From what I see in the documentation this should be correct.

handlers.verifySessionTicket = function(args, context) {

    var sessionTicket = null;
    if (args && args.SessionTicket) 
        sessionTicket = args.sessionTicket

    var request = {
        SessionTicket: sessionTicket
    };

    var response = server.AuthenticateSessionTicket(request);
    return { responseContent: response}
}
CloudScript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Joshua Strunk avatar image
Joshua Strunk answered

My guess is that sessionTicket is being left as null which is then considered not a valid argument for that api call.

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Crazed Pyro avatar image Crazed Pyro commented ·

I printed out the data being sent to PlayFab and it looks correct though? It shouldn't be null unless i'm missing something

{'FunctionParamater': {'SessionTicket': '<removed>'}, 'GeneratePlayStreamEvent': True, 'FunctionName': 'verifySessionTicket', 'RevisionSelection': 'Live'}

I'm having to write my own SDK for Python since you guys don't have one yet to do this.
0 Likes 0 ·
Joshua Strunk avatar image Joshua Strunk Crazed Pyro commented ·

Well, that does look good.

Try adding the following to your CloudScript handler.

log.info("args: " + JSON.stringify(args));

log.info("request: " + JSON.stringify(request));

I would also try issuing the CloudScript request through Postman or the GameManager either under through a Player account screen or Automation->Scheduled Task. That way, because your working on a custom sdk, you can see the full result of the ExecuteCloudScript api call.

0 Likes 0 ·
brendan avatar image brendan Crazed Pyro commented ·

This is one of those "if it was a snake, it would have bit me" problems - very easy to miss. The problem is that the case of "sessionTicket" argument isn't the same between the if check and the assignment.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.