Facebook login + token grab

1 vote · 0 comments

Got it from the moai forum, I though it should be here.

raw ·
copy
· download
appId = 'Your facebook app ID' MOAIFacebookAndroid.init ( appId ) function loginSuccessCallback () mToken = MOAIFacebookAndroid.getToken () eToken = MOAIFacebookAndroid.getExpirationDate () // Shows token and expiration date on the device since print is broken in the Android host MOAIDialog.showDialog ( eToken, mToken, "Yes", "Maybe", "No", true, nil ) end /* checks if an instance of MOAIFacebookAndroid exists if so, check if is the setListener exists if so, add a callback to the successful login then, if login exists, use it and ask for permissions if successful will trigger the callback above */ if MOAIFacebookAndroid then if MOAIFacebookAndroid.setListener then MOAIFacebookAndroid.setListener ( MOAIFacebookAndroid.SESSION_DID_LOGIN, loginSuccessCallback ) end if MOAIFacebookAndroid.login then // For a list of permissions visit https://developers.facebook.com/docs/reference/login/ MOAIFacebookAndroid.login ( {'publish_actions'} ) end end

Be the first to comment

Sign in with OpenID