facebook v4 login cancelled (android)

I’ve been searching for this problem days ago. Someone said that is because the generated key hash may not be right in Window, so I tried different versions of openssl but all of them generated the same key hash (in both Window 32 bit and 64 bit). To express my problem clearer, let’s call this old key hash ‘X’. Then I used a software to generate key hash, this time it returned a different one, let’s call this new key hash ‘Y’.

When I used key hash X, my facebook account was able to post normally, but for different facebook users, it always returns ‘login cancelled’. I’m finding fb4a/facebook/blueservice and corona messages in adb but I can’t see any of them… (I typed in adb logcat, the text goes so fast I may missed them :o , adb logcat corona:v *:s doesn’t show anything)

When I used key hash Y, my facebook account couldn’t post, facebook returned something like ‘key hash X (my old key hash) doesn’t match any store key hash’. And other facebook users couldn’t login or authorized to do anything.

Someone said they could get a right key hash in Mac, but I don’t have one, so I don’t know which way I could try to fix this ‘login cancelled’ problem.

Here is the build.settings

settings = { plugins = { ["plugin.coronaAds"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["plugin.facebook.v4"] = { publisherId = "com.coronalabs" }, }, orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait", "portraitUpsideDown"} }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, -- -- iOS Section -- iphone = { plist = { -- For iOS 9+ only NSAppTransportSecurity = { NSExceptionDomains = { ["fbcdn.net"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, ["facebook.com"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, ["akamaihd.net"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, }, }, LSApplicationQueriesSchemes = { "fb", "fbapi20130214", "fbapi20130410", "fbapi20140410", "fbapi20140116", "fbapi20150313", "fbapi20150629", "fbauth", "fbauth2", "fb-messenger-api20140430", }, -- For all version of iOS. CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-167.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, UIApplicationExitsOnSuspend = false, -- must be false for single sign-on to work FacebookAppID = "myappID", -- replace XXXXXXXXX with your facebook appId CFBundleURLTypes = { { CFBundleURLSchemes = { "fbmyappID", -- replace XXXXXXXXX with your facebook appId } } } } }, -- -- Android Section -- android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", }, facebookAppId = "myappID", }, }

listener function 

 if ( "session" == event.type ) then if event.phase=="logout" then statusMessage.textObject.text="logged out" end if event.phase=="login" then statusMessage.textObject.text="logged in" local sendscore = loadFile("highScore.txt") local attachment = { name = "", link = "http://play.google.com/store/apps/details?id=myapppackage", description = "" , picture = "", actions = json.encode( { { name = "", link = "http://play.google.com/store/apps/details?id=myapppackage" } } ) } facebook.request( "me/feed", "POST", attachment ) end if (event.phase=="loginFailed") or (event.phase=="loginCancelled") then statusMessage.textObject.text="login failed" end --checking status if event.phase ~= "login" then statusMessage.textObject.text = event.phase end

statusMessage display: login cancelled. 

I try to login with this code:

facebook.login( facebookAppID, listener, { “user_friends”, “email” } )

facebook.login( facebookAppID, listener, {“publish_actions”, “email” })

We have a known issue about people getting loginCancelled messages when they shouldn’t. Engineering is looking into the problem.

That said, you still have to make sure your has is right. Running:

adb logcat corona:v *:s

won’t work. It only shows Corona messages. The facebook messages from from facebook. You have to do:

adb logcat

and dig through the volume of messages looking for  Facebook related messages.

Rob

Thank you for you reply, I tried adb logcat>logcat.txt so I can see the messages now, it’s the same problem, users are not authorized to post anything and event.phase is always loginCancelled. If I change key hash, even my facebook account can’t post  :mellow: I’ll try to find other way to fix this problem. In case this is a bug then I guess it can’t be help, hopefully it’ll work for me one day. Thank you again  :slight_smile:

Can you post your logcat.txt?

This is the latest logcat (attachment), after I pressed Share button and went to fb.lua scene, no message from fb4a. I’ve tested many versions of this app, logged in and out to different facebook accounts. Before this latest logcat, fb4a messages were:

fb4a(:<default>):QeInternalImpl(19631): The sessioned store is not available. Are you fetching sessioned quick experiment data while the user is logged out?

fb4a(:<default>):ServiceInfoParser(20334): com.facebook.common.jobscheduler.compat.ServiceInfoParser$NoJobMetaDataFoundException: Service com.facebook.backgroundlocation.reporting.BackgroundLocationReportingGcmUploadService is missing meta key com.facebook.common.jobscheduler.compat.jobIds

W/fb4a(:<default>):ServiceInfoParser(20334): com.facebook.common.jobscheduler.compat.ServiceInfoParser$NoJobMetaDataFoundException: Service com.facebook.bugreporter.scheduler.GCMBugReportService is missing meta key com.facebook.common.jobscheduler.compat.jobIds

fb4a(:<default>):UserScope(20334): Called user scoped provider with no viewer. ViewerContextManager was created with no ViewerContext. Using EmptyViewerContextManager to return fake logged in instance.

fb4a(:<default>):GraphQLQueryAnalyticsEventImpl(20334): error in step network

fb4a(:<default>):GraphQLQueryAnalyticsEventImpl(20334): com.facebook.http.protocol.AuthTokenNullException: auth token is null, user logged out? ( :o ?)

or

fb4a(:<default>):GRAPHQL_QUERY_STRING( 8490): Trying to set unknown parameter ‘in_channel_eligibility_experiment’ on query ‘FetchProductionPromptsQuery’

fb4a(:<default>):RequestLoggingListener( 8490): time 192884696: onRequestFailure: {requestId: 4, elapsedTime: -1 ms, throwable: java.lang.NullPointerException: Encoded image is not valid.}

(well I couldn’t understand these fb4a messages  :wacko: but at least they showed up)

Most of the time it’ll receive token, when I pressed Share button, statusMessage was ‘logged in’, but after pressing confirm, executed facebook.login(listener, {publish_actions}), tried to post something, statusMessage was loginCancelled. 

I didn’t see messages about userID or grantedpermissions table(user_friends, contact_email, …), if they showed up, I rarely see publish_actions, but public_profile instead.

I don’t know why each time it’s different, is it because the code, app versions or at that time I didn’t cleared up cache in my phone properly?

What should I try next?

Thank you for your patience  :slight_smile:

This is a problem that we’re chasing in Engineering right now.

Rob

Is your app on the facebook portal “Live” or “In Development”? If live, did you go through Facebook’s submission process requesting “publish_actions”?

Rob

We have a known issue about people getting loginCancelled messages when they shouldn’t. Engineering is looking into the problem.

That said, you still have to make sure your has is right. Running:

adb logcat corona:v *:s

won’t work. It only shows Corona messages. The facebook messages from from facebook. You have to do:

adb logcat

and dig through the volume of messages looking for  Facebook related messages.

Rob

Thank you for you reply, I tried adb logcat>logcat.txt so I can see the messages now, it’s the same problem, users are not authorized to post anything and event.phase is always loginCancelled. If I change key hash, even my facebook account can’t post  :mellow: I’ll try to find other way to fix this problem. In case this is a bug then I guess it can’t be help, hopefully it’ll work for me one day. Thank you again  :slight_smile:

Can you post your logcat.txt?

This is the latest logcat (attachment), after I pressed Share button and went to fb.lua scene, no message from fb4a. I’ve tested many versions of this app, logged in and out to different facebook accounts. Before this latest logcat, fb4a messages were:

fb4a(:<default>):QeInternalImpl(19631): The sessioned store is not available. Are you fetching sessioned quick experiment data while the user is logged out?

fb4a(:<default>):ServiceInfoParser(20334): com.facebook.common.jobscheduler.compat.ServiceInfoParser$NoJobMetaDataFoundException: Service com.facebook.backgroundlocation.reporting.BackgroundLocationReportingGcmUploadService is missing meta key com.facebook.common.jobscheduler.compat.jobIds

W/fb4a(:<default>):ServiceInfoParser(20334): com.facebook.common.jobscheduler.compat.ServiceInfoParser$NoJobMetaDataFoundException: Service com.facebook.bugreporter.scheduler.GCMBugReportService is missing meta key com.facebook.common.jobscheduler.compat.jobIds

fb4a(:<default>):UserScope(20334): Called user scoped provider with no viewer. ViewerContextManager was created with no ViewerContext. Using EmptyViewerContextManager to return fake logged in instance.

fb4a(:<default>):GraphQLQueryAnalyticsEventImpl(20334): error in step network

fb4a(:<default>):GraphQLQueryAnalyticsEventImpl(20334): com.facebook.http.protocol.AuthTokenNullException: auth token is null, user logged out? ( :o ?)

or

fb4a(:<default>):GRAPHQL_QUERY_STRING( 8490): Trying to set unknown parameter ‘in_channel_eligibility_experiment’ on query ‘FetchProductionPromptsQuery’

fb4a(:<default>):RequestLoggingListener( 8490): time 192884696: onRequestFailure: {requestId: 4, elapsedTime: -1 ms, throwable: java.lang.NullPointerException: Encoded image is not valid.}

(well I couldn’t understand these fb4a messages  :wacko: but at least they showed up)

Most of the time it’ll receive token, when I pressed Share button, statusMessage was ‘logged in’, but after pressing confirm, executed facebook.login(listener, {publish_actions}), tried to post something, statusMessage was loginCancelled. 

I didn’t see messages about userID or grantedpermissions table(user_friends, contact_email, …), if they showed up, I rarely see publish_actions, but public_profile instead.

I don’t know why each time it’s different, is it because the code, app versions or at that time I didn’t cleared up cache in my phone properly?

What should I try next?

Thank you for your patience  :slight_smile:

This is a problem that we’re chasing in Engineering right now.

Rob

Is your app on the facebook portal “Live” or “In Development”? If live, did you go through Facebook’s submission process requesting “publish_actions”?

Rob