Select to view content in your preferred language

Too big expires response

1609
3
03-06-2014 06:05 AM
EkaitzHernandez
Emerging Contributor
Hi All!

I have problem when I generate a token with this endpoint 'https://www.arcgis.com/sharing/rest/generateToken'

It doesn't matter what I pass to 'expiration' parameter than I receive very big values for 'expires'

{
  "token": "<token generated>",
  "expires": <date shown in UNIX time>
  "ssl": false | true
}

I receive this timestamp in "expires" property-> 13941214241 translates to Wednesday, October 12th 2411, 15:30:41 (GMT) when the maximun should be 15 days.

More information here http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000m5000000

Thanks!!
Ekiatz
0 Kudos
3 Replies
RichardWatson
Deactivated User
The ESRI link says that it is returning milliseconds.  It looks like the date you posted is correct if they returned seconds.

I am wondering if you left off a digit in the number you posted?

Here is the code to perform the conversion:

        static void Main(string[] args)
        {
            const long millisecondsSinceEpoch = 13941214241;
            var time = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            var expires = time.AddMilliseconds(millisecondsSinceEpoch);
            Console.WriteLine(expires);
        }.
0 Kudos
EkaitzHernandez
Emerging Contributor
The ESRI link says that it is returning milliseconds.  It looks like the date you posted is correct if they returned seconds.

I am wondering if you left off a digit in the number you posted?

Here is the code to perform the conversion:

        static void Main(string[] args)
        {
            const long millisecondsSinceEpoch = 13941214241;
            var time = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            var expires = time.AddMilliseconds(millisecondsSinceEpoch);
            Console.WriteLine(expires);
        }.


Ok sorry I didn't see that, but if is miliseconds 13941214241  is 161 days when the maximun should be 15 days.
0 Kudos
RichardWatson
Deactivated User
Please post the complete JSON response which contains the token which was issued.
0 Kudos