question

leo-1 avatar image
leo-1 asked

Using context.authenticationContext to retrieve the clientIpAddress in a cloud script

I'm trying to delete all the users that fail my authentication system but =I am unable to get the Client IP address from the authenticationContext to run this piece of code

 var ip = context.authenticationContext.clientIpAddress;
     
  var result = server.GetAllUsersCharacters({
              "TitleId": "C5381",
              "PageSize": size,
              "SkipToken": skipToken,
              "ExtraHeaders": {"X-Forwarded-For": ip}
         });

but the IP returns nothing

CloudScriptAuthentication
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

·
Xiao Zha avatar image
Xiao Zha answered

The context in the Leagcy CloudScript doesn’t contain the authenticationContext property. And if you call ExecuteCloudScript API to execute the cloudscript, the context is like this: {\"playerProfile\":null,\"playStreamEvent\":null,\"triggeredByTask\":null}, it’s null. Also, the Get All Users Characters API request body only requires a PlayFabId property. May I know how you implemented your authentication system? And what is the IP address work for?

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.