Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What date format does Facebook use for the expiration access_token?

Tags:

.net

facebook

I'm trying to make sure I get the conversion to DateTime right, using a .Net service to connect want want to store the expiration in a database for later use.

like image 697
blueberryfields Avatar asked Dec 06 '22 15:12

blueberryfields


2 Answers

If you are talking about the expires parameter that comes back with the access_token, then it is seconds until it expires.

Do

DateTime expires = DateTime.UtcNow;
expires.AddSeconds(seconds);

and there is your expiry date.

like image 71
Adam Avatar answered May 14 '23 14:05

Adam


Looks like things were changed yet again. Multiply the returned expiration value (expires_at) by 1000 to get the epoch. In JavaScript anyways, the expiration can be calculated with:

new Date(expires_at * 1000);
like image 43
Paul Go Avatar answered May 14 '23 14:05

Paul Go