Storing facebook token for offline access

前端 未结 3 972
礼貌的吻别
礼貌的吻别 2021-01-03 16:54

I am looking for a way to save the access token to allow the user to post on facebook without having to log in for each call to the graph API :

I require an offline_

3条回答
  •  迷失自我
    2021-01-03 17:32

    I was having the same problem and I found out that the issue is you are not storing expiration date.

    If you do that, it will allow you to relogin in fine.

    Sample code:

     [[NSUserDefaults standardUserDefaults] setObject:_facebook.accessToken forKey:@"fb_access_token"];
     [[NSUserDefaults standardUserDefaults] setObject:_facebook.expirationDate forKey:@"fb_exp_date"];
    

    Retrieving is the same, just set the _facebook.expirationDate.

提交回复
热议问题