I am trying to get users' permission for 'offline_access' in an iFrame Facebook application coded with the Facebook Java API. I understand that I need to obtain an 'indefinite session key' after the users approves my application. Currently, I can accomplish what I want, but in a very awkward way that is probably not correct. There must be a better way to do this. Any thoughts/ideas would be appreciated!!
In a servlet of my app, I check to see if the user currently has 'offline_access' permission. If they do, I get the url by Permission.authorizeUrl(Permission.OFFLINE_ACCESS)
. I then call response.redirect
to get to the permissions page. Two problems I'm having are:
client.getCacheSessionKey
) unless the user goes back to a page in my app manually. Have you tried using the fb:promot-permission
tag in XFBML? That would seem the simplest way of getting the permission granted, and XFBML is fairly easy to set up.