I am developing a desktop application in Java which provides chat function to users. I am using smack API and I am using X-Facebook Platform for logging in. I have developed a class which can connect to facebook and authenticate if session key available. But I can't figure out how to do this?

And also how can I set xmpp_login and offline_access permissions after logging in of user? I read the authentication documentation on Facebook but can't understand, url commands there require a redirect url for the app, but I have no url attached with the app as it has nothing to do inside facebook window.