question

Dylan Hunt avatar image
Dylan Hunt asked

[RESOLVED] Struggling with x-authentication header with AJAX

EDIT: Resolved because I put the URL as /PFUpdateUserData by accident instead of /UpdateUserData -- gah.. I copied the name of my function name. Anyway, still good template below.

 

Looking at this:

OST https://{
                 {TitleID}}.playfabapi.com/Client/UpdateUserData
Content-Type: application/json;
X-Authentication: <user_session_ticket_value>{
  "Data": {
    "Class": "Fighter",
    "Gender": "Female",
    "Icon": "Guard 3",
    "Theme": "Colorful"
  },
  "Permission": "Public"
}

I'm struggling getting errors everywhere using AJAX. Registration worked fine, but now that I need to x-auth, I can't find the right way to do this!

I'm trying this:

var json =
{
"Data":
{
"PlayerFirstName": FirstName,
"PlayerLastName": LastName
//"PlayerGender": Gender,
},
"Permission": "Public"
};

...

type: "POST",
url: url,
data: JSON.stringify(json),
contentType: 'application/json;charset=utf-8',
dataType: 'json',
timeout: 5000,
headers:
{
'X-authentication' : SessionTicket // Definitely a valid one
},
cache: false,

success: function (data)
{ ...



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

·
brendan avatar image
brendan answered

Copy/paste strikes us all at some point. Glad you managed to resolve this. :)

10 |1200

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

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.