Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Expiration Date of access token in Facebook SDK for Unity

I am using parse sdk for backend management for my game. For user signup/login parse api ask for parameter tokenExpiration. I have no idea how to get it from facebook unity sdk. https://www.parse.com/docs/unity_guide#fbusers-signup

Task<ParseUser> logInTask = ParseFacebookUtils.LogInAsync(accessToken, userId, tokenExpiration);
like image 588
Rohit Goyal Avatar asked Dec 10 '25 08:12

Rohit Goyal


1 Answers

Got this problem solved by myself using debug_token. Here is the right code on how to do it.

FB.API("/debug_token?input_token="+FB.AccessToken+"&access_token="+FB.AccessToken,Facebook.HttpMethod.GET, AccessTokenCallback);
function AccessTokenCallback(response:String){
Debug.Log(response);
var access = JSON.Parse(response);
Debug.Log("Token Expiration is: "+access["data"]["expires_at"].Value);
}

If you will print the response it will give you a JSON with all information about the access token and you can take whatever info you need about an access token.

like image 62
Rohit Goyal Avatar answered Dec 14 '25 08:12

Rohit Goyal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!