we are planning to integrate DB with some external service which requires user IP address to work. Is it possible to get current IP from player?
Best Answer
C
Customer Support
said
almost 5 years ago
Hi Marcin,
You can provide the IP Address from the client and send it to the Cloud Code to save on the Gamesparks DB. It is not possible to infer the IP Address from the Cloud Code on it's own.
In Unity this is as simple as:
using System.Net;
using System.Net.Sockets;
IPHostEntry host;
string localIP = "";
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
localIP = ip.ToString();
break;
}
}
You can then send this string with any of our requests such as Authentication, Registration or LogEvent. Then in the Cloud Code for these events, save the attribute in a collection, or even the player's privateData.
You can provide the IP Address from the client and send it to the Cloud Code to save on the Gamesparks DB. It is not possible to infer the IP Address from the Cloud Code on it's own.
In Unity this is as simple as:
using System.Net;
using System.Net.Sockets;
IPHostEntry host;
string localIP = "";
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
localIP = ip.ToString();
break;
}
}
You can then send this string with any of our requests such as Authentication, Registration or LogEvent. Then in the Cloud Code for these events, save the attribute in a collection, or even the player's privateData.
If you have any other questions let me know.
-Pádraig
M
Marcin Olszewski
said
almost 5 years ago
Cool, thank you, this will help. But for the future that would be great to get that kind of data exactly from cloud code:)
M
Marcin Olszewski
said
almost 5 years ago
I've double checked and noticed that you solution only returns lokal network IP adress (like 192.168.xxx)
Customer Support
said
over 4 years ago
Hey Marcin,
There are many ways to get the IP from the client -> http://forum.unity3d.com/threads/get-ip-address.100109/ We do not store the IP on the player-doc as we do not currently use it for anything. However you can get the IP from the client and us it in cloud-code as you wish. You should be careful however, as none of these methods are 100% reliable and are based on ISP rules too.
Sean
a
ahsan muzaheed
said
over 4 years ago
hi. i was wondering if it's gamespark's limitation that it cannot have player's ip address. or for security reason they dont provide ip address
Customer Support
said
over 4 years ago
Hi Ahsan,
In line with Data Protection conventions, we do not have direct or access, nor do we expose the ip address of users. Apologies for any inconvenience caused.
Marcin Olszewski
Hi,
we are planning to integrate DB with some external service which requires user IP address to work. Is it possible to get current IP from player?
Hi Marcin,
You can provide the IP Address from the client and send it to the Cloud Code to save on the Gamesparks DB. It is not possible to infer the IP Address from the Cloud Code on it's own.
In Unity this is as simple as:
You can then send this string with any of our requests such as Authentication, Registration or LogEvent. Then in the Cloud Code for these events, save the attribute in a collection, or even the player's privateData.
If you have any other questions let me know.
-Pádraig
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Marcin,
You can provide the IP Address from the client and send it to the Cloud Code to save on the Gamesparks DB. It is not possible to infer the IP Address from the Cloud Code on it's own.
In Unity this is as simple as:
You can then send this string with any of our requests such as Authentication, Registration or LogEvent. Then in the Cloud Code for these events, save the attribute in a collection, or even the player's privateData.
If you have any other questions let me know.
-Pádraig
Marcin Olszewski
Cool, thank you, this will help. But for the future that would be great to get that kind of data exactly from cloud code:)
Marcin Olszewski
Customer Support
There are many ways to get the IP from the client -> http://forum.unity3d.com/threads/get-ip-address.100109/
We do not store the IP on the player-doc as we do not currently use it for anything. However you can get the IP from the client and us it in cloud-code as you wish. You should be careful however, as none of these methods are 100% reliable and are based on ISP rules too.
Sean
ahsan muzaheed
hi.
i was wondering if it's gamespark's limitation that it cannot have player's ip address. or for security reason they dont provide ip address
Customer Support
Hi Ahsan,
In line with Data Protection conventions, we do not have direct or access, nor do we expose the ip address of users. Apologies for any inconvenience caused.
Best Regards, Patrick.
-
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 2486 topics