Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Facebook frustrations
Started by Rob Miracle Jul 27 2013 12:33 PM

90 replies to this topic
[TOPIC CONTROLS]
Page 3 of 4 1 2 3 4
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#51

editor

[GLOBAL: userInfoPane.html]
editor
  • Enthusiast

  • 98 posts
  • Corona SDK

I found this:

http://stackoverflow.com/questions/4388992/key-hash-for-android-facebook-app

 

Seems there's more than one way to get a key hash, and they don't all work properly!

 

I'll have a play and see what I find.



[TOPIC: post.html]
#52

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,328 posts
  • Corona Staff

Usually in this case, I like to see the build screen that you're building against.  Then I'd like to see the command you are entering to create your hash key.

 

Rob



[TOPIC: post.html]
#53

editor

[GLOBAL: userInfoPane.html]
editor
  • Enthusiast

  • 98 posts
  • Corona SDK

Hi Rob,

 

I don't have the command that produced the original hash anymore.  Pretty sure I used the one that was in the Facebook tutorial that was linked from the Corona facebook documentation (which has now moved somewhere else).  A post I found on StackOverflow seemed to indicate that generally the given windows commands don't work.  They said to use different parameters, so this is what I've used:

 

keytool -export -alias cricket -keystore C:\Users\daniel kirk\Dropbox\Best Cricket Graphics 2.0\bestcricket.keystore | openssl sha1 -binary | openssl en -a -e

 

From the build screen, I copy/paste the keystore:

C:\Users\daniel kirk\Dropbox\Best Cricket Graphics 2.0\bestcricket.keystore

 

I'm pretty sure the alias and package name are all matched up correctly.

 

In facebook, I've got both the hash from the command above, and the original hash has been kept too.

 

Using this new hash, I've got the same problem as the old one

 

Here's the event data again:

 

I/Corona  (15165): event.name   fbconnect
I/Corona  (15165): event.type:  session
I/Corona  (15165): isError: false
I/Corona  (15165): didComplete: nil
I/Corona  (15165): response :
I/Corona  (15165): phase : loginCancelled

 

thanks again!

 

Daniel



[TOPIC: post.html]
#54

editor

[GLOBAL: userInfoPane.html]
editor
  • Enthusiast

  • 98 posts
  • Corona SDK

Hi Rob,

 

One thing I wasn't sure about was which version of openssl to download for Windows.  How do I know if I should use 32 or 64 bit?

 

I've been using 32 bit, I just tried 64 but the keytool command didn't work as apparently 'en' is not a valid option with it.



[TOPIC: post.html]
#55

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,328 posts
  • Corona Staff

I don't know much about the difference between the 32 and 64 bit versions but I would think the 32 bit version would be the safest.

 

The command that you get from facebook's documentation is based on using a debug keystore (and not a release one) and it assumes that you use the keystore in the Android SDK folder.  Corona SDK uses a default debug keystore that we distribute with Corona and they are different debug keystores.  This is why I want to see your build screen to see what keystore you are really using.

 

The default windows example assumes the keystore is in a specific place and for some people that's not where their keystore is.  We've tried to explain everything here:

 

http://coronalabs.com/blog/2013/07/30/understanding-facebook-authentication/

 

The way the command's are pipelined through each other, you are going to get a keyhash when you are done, regardless of if the keytool command actually output anything or you putting in a correct password.  Usually Facebook tells you in the adb logcat output that the keystore is wrong and what it's expecting, though you can't exactly copy/paste that string because of the missing = sight at the end and I think another character may not be right. 

 

The log message will likely not be generated by Corona so if you're doing the adb logcat with Corona on the command line, it's likely filtering out the message from Facebook.

 

Just do:

 

adb logcat

 

and look for keystore error messages.

 

Rob



[TOPIC: post.html]
#56

editor

[GLOBAL: userInfoPane.html]
editor
  • Enthusiast

  • 98 posts
  • Corona SDK

Hi Rob,

 

I found this message in adb:

 

W/fb4a(:<default>):BlueServiceQueue(15071): com.facebook.http.protocol.ApiExcept
ion: Key hash EtKha0DGwILWPU6JviNQMTfSfvg does not match any stored key hashes.

 

The reason I didn't post a screenshot of my build screen is that last time I tried that in this forum it said that it "couldn't accept files of this type."

 

But I did copy/paste from the build screen...

 

Keystore : C:\Users\daniel kirk\Dropbox\Best Cricket Graphics 2.0\bestcricket.keystore

 

 

Which to me looks like it matches what I've got in the command:

keytool -export -alias cricket -keystore C:\Users\daniel kirk\Dropbox\Best Cricket Graphics 2.0\bestcricket.keystore | openssl sha1 -binary | openssl en -a -e

 

 

I'm going to start from scratch and see what happens.  Wouldn't have a clue where I could have gone wrong though



[TOPIC: post.html]
#57

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,328 posts
  • Corona Staff

The log file tells you what the Key should be:
 

EtKha0DGwILWPU6JviNQMTfSfvg

 

but it's missing the = at the end, so try:

 

EtKha0DGwILWPU6JviNQMTfSfvg=

 

Rob



[TOPIC: post.html]
#58

michael714

[GLOBAL: userInfoPane.html]
michael714
  • Contributor

  • 170 posts
  • Corona SDK

Hey Rob,

Merry Christmas!   I spent a day fiddling with changing this variable and that variable to get the Corona Scrumptious sample app to work.   In the end, when I entered the Facebook App ID into the loginScreen.lua file, I entered it without quotes, hence it was not a string.  Oy!  Also, you need to enter the Facebook App ID into the mainScreen.lua file (also as a string).

 

Never got an error message that indicated that was a problem.  Cost me about 8 hours of troubleshooting!   Just a warning for others. 



[TOPIC: post.html]
#59

jairus8

[GLOBAL: userInfoPane.html]
jairus8
  • Observer

  • 6 posts
  • Corona SDK

any solutions on this... im also getting the loginCancelled... hash all setup properly...



[TOPIC: post.html]
#60

michael714

[GLOBAL: userInfoPane.html]
michael714
  • Contributor

  • 170 posts
  • Corona SDK

Hello,

I wrote up a tutorial for Facebook for Android debug builds right here:

http://forums.coronalabs.com/topic/42655-facebook-101-for-android-debug-build/

 

Hopefully that helps!



[TOPIC: post.html]
#61

sajoga

[GLOBAL: userInfoPane.html]
sajoga
  • Observer

  • 9 posts
  • Corona SDK

Hi,

 

I'm having headaches already...

 

Platforms: I'm having problems with both.

Corona SDK: 2014.2189 (2014.3.6)

Facebook operation: I'm trying "apprequest", but it's not working. I only got "the page you requested was not found" message.

Friend list when i use the "showDialog("friends", onComplete)" it's empy.

Login, logout and self publishing works fine. 

-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------

local facebook = require("facebook")
local widget = require("widget")

--ID de la aplicación
local FBAppID = "521039174688673"


local function onComplete( event )
	print("event.name:", event.name)
	print("event.type:", event.type)

	if (event.data) then
		print(" { ")

		for k, v in pairs( event.data) do
			print(k, " : " , v)
		end

		print(" } ")
	end
end

local function listener( event )
	print( "event.name", event.name )  --"fbconnect"
    print( "event.type:", event.type ) --type is either "session", "request", or "dialog"
    print( "isError: " .. tostring( event.isError ) )
    print( "didComplete: " .. tostring( event.didComplete ) )

	if	("session" == event.type) then
		if ("login" == event.phase) then
			facebook.showDialog("apprequest", {message="Prueba de invitación"})
		end
	elseif ("dialog"==event.type) then
		print(event.response)
	elseif ("request" == event.type) then
		print(event.response)			
	end
end

-- muestra amigos
local function showFriends(event)
	if (event.phase =="ended") then
		facebook.showDialog("friends", onComplete)
	end
	return true
end


-- Ventana emergente para publicar en el muro
local function publishFeed( event )
	if (event.phase == "ended") then
		--facebook.request("me/feed", "POST", {message="Probando librerias de FB para Corona. Disculpen las molestias"})
		facebook.showDialog("feed", {message="más pruebas de desarrollo"})
	end
	return true
end


-- peticion de instalacion
local function appRequest( event )
	if (event.phase == "ended") then
		facebook.showDialog("apprequest", {message="Probando a invitar amigos..."})
	end
	return true
end

-- login en facebook
local function login( event )
	print("---------------- entrando en método de login")
	if (event.phase == "ended") then
		--login
		facebook.login(FBAppID, listener, {"publish_actions"})
		print( "------------------- login realizado" )
		
		--Registro de instalación en la web
		print ("------------------- registrando instalacion")
		facebook.publishInstall(FBAppID)
		print( "------------------- registro realizado" )
		--buttonFriends:setEnabled( true )
		--buttonPublish:setEnabled( true )
		--buttonAppRequest:setEnabled( true )
		--buttonLogin:setEnabled( false )
	end

	return true
end

-- logout
local function logout( event )
	print("---------------- entrando el el método de logout")
	if (event.phase == "ended") then
		facebook.logout( )
		print( "--------------- logout realizado" )
	end

	return true
end


-- elementos de la interfaz
local buttonLogin = widget.newButton{
	label = "Login",
	onEvent = login,
	x = display.contentCenterX,
	y = display.contentCenterY - 120
}

local buttonLogout = widget.newButton{
	label = "Logout",
	onEvent = logout,
	x = display.contentCenterX,
	y = display.contentCenterY + 120
}

local buttonFriends = widget.newButton{
	label = "Elige amigos",
	onEvent = showFriends,
	x = display.contentCenterX,
	y = display.contentCenterY - 40
}

local buttonPublish = widget.newButton{
	label = "Publicar en mi muro",
	onEvent = publishFeed,
	x = display.contentCenterX,
	y = display.contentCenterY + 40
}

local buttonAppRequest = widget.newButton{
	label = "Peticion",
	onEvent = appRequest,
	x = display.contentCenterX,
	y = display.contentCenterY + 80
}

And build.settings

-- Supported values for orientation:
-- portrait, portraitUpsideDown, landscapeLeft, landscapeRight

settings = {
	
	orientation = {
		default = "portrait",
		supported = { "portrait", }
	},
	
	iphone = {
		plist = {
			UIStatusBarHidden = false,
			UIPrerenderedIcon = true, -- set to false for "shine" overlay
			--UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend

            FacebookAppID = "521039174688673",
            -- iOS app URL schemes:
            CFBundleURLTypes =
            {
                {
                    CFBundleURLSchemes =
                    {
                        "fb521039174688673", -- example scheme for facebook
                    }
                }
            }
            
		}
	},
	
	--Prueba de facebook
	plugins = 
	{
		["facebook"] = {
			publisherId = "com.coronalabs",
			supportedPlatforms = {iphone=true, ["iphone-sim"]=true},
		},
	},
	
	-- Android permissions

	androidPermissions = {
  		"android.permission.INTERNET",
  	},

	
}

Thanks.



[TOPIC: post.html]
#62

sajoga

[GLOBAL: userInfoPane.html]
sajoga
  • Observer

  • 9 posts
  • Corona SDK

Lord Jesus... It's "apprequests", not "apprequest" :unsure:

 

One more thing. I guess it has to be configured in build.settings, but, how do I configure the Play Store url (or id) where the application is? With iOS, adding the iPhone/iPad Store ID in the Facebook app iOS configuration page is enough to download de app when a request is clicked. How do I configure the URL for the Andoid app?

 

Thanks one more time.



[TOPIC: post.html]
#63

sign.in

[GLOBAL: userInfoPane.html]
sign.in
  • Enthusiast

  • 58 posts
  • Enterprise

Hi, i see you managed to fix your issue with facebook.showDialog and apprequest.

I confirm apprequests is working for me as well.

 

I wonder, can you use properly the facebook.showDialog with feed?

 

Is it working?

 

Talking about Facebook Frustrations, this is one.

 

Managed to fix the issue of facebook.showDialog.

Came from a property in advanced setting of the facebook app dashboard.

http://forums.coronalabs.com/topic/49213-problems-to-implement-facebookshowdialog-yes-i-know-another-one/#entry254712



[TOPIC: post.html]
#64

sajoga

[GLOBAL: userInfoPane.html]
sajoga
  • Observer

  • 9 posts
  • Corona SDK

Hi,

 

I'm trying to get all the apprequests of my application, but it seems that facebook.request( "me/apprequests", "GET", {fields="..."} ) gets all apps pending requests.

 

I know I can set the field 'application' and compare results to get only the ones with the same id of my app, but I want to know if I can retrieve only my app's pending requests.

 

Thanks a lot!



[TOPIC: post.html]
#65

appstore3

[GLOBAL: userInfoPane.html]
appstore3
  • Observer

  • 5 posts
  • Corona SDK

Hi Guys,

 

I am making a game for iOS. I have integrated Facebook login and score share functionality in this. I have a problem that if I login my game through facebook's developer id and click fb button to share score, login works well and score share also works perfectly fine with showDialog() function.

But if I use any other Facebook account to login, login goes fine but score share crashes and gives me following error in crash log:

 

    The operation couldn’t be completed. (com.facebook error 123.) corona

 

Please help. Urgently need some help. Thanks in advance.



[TOPIC: post.html]
#66

schizoid2k

[GLOBAL: userInfoPane.html]
schizoid2k
  • Contributor

  • 541 posts
  • Corona SDK

Hi Guys,

 

I am making a game for iOS. I have integrated Facebook login and score share functionality in this. I have a problem that if I login my game through facebook's developer id and click fb button to share score, login works well and score share also works perfectly fine with showDialog() function.

But if I use any other Facebook account to login, login goes fine but score share crashes and gives me following error in crash log:

 

    The operation couldn’t be completed. (com.facebook error 123.) corona

 

Please help. Urgently need some help. Thanks in advance.

 

Did you submit the app to Facebook for review?  Before anything can be posted to FB, tehy review the app and then approve the permissions you need.  For the developer account, it works.



[TOPIC: post.html]
#67

marc.jd

[GLOBAL: userInfoPane.html]
marc.jd
  • Observer

  • 14 posts
  • Corona SDK

Hello.my problem is that when I try to log in to facebook sometimes it works but most of the time it freezs then a min later it crashes plz help
Corona build.2014.2393
Android 4.4.2
Facebook operation: log in so I can make a score leaderboard of friends on facebook
Permission needed: user_friends. Public_profile

[TOPIC: post.html]
#68

marc.jd

[GLOBAL: userInfoPane.html]
marc.jd
  • Observer

  • 14 posts
  • Corona SDK

Hello.my problem is that when I try to log in to facebook sometimes it works but most of the time it freezs then a min later it crashes plz help
Corona build.2014.2393
Android 4.4.2
Facebook operation: log in so I can make a score leaderboard of friends on facebook
Permission needed: user_friends. Public_profile

[TOPIC: post.html]
#69

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi @marc.jd,

Can you please provide more details and some code, and ideally an error messages you're getting in the console error dump? We'll need more information to help assist you.

 

Thanks,

Brent



[TOPIC: post.html]
#70

marc.jd

[GLOBAL: userInfoPane.html]
marc.jd
  • Observer

  • 14 posts
  • Corona SDK

ok so i cn log in just one time then it freeze again after i log out or cancel the login

build setting.

 

-----build setting-------------
 
settings =
{
   orientation = 
   {
      default = "landscapeRight",        supported = 
      {
         "landscapeRight","landscapeLeft"
      },
   },
 
   android =
   {
      googlePlayGamesAppId = "XXXXXXXX",
      usesPermissions =
      {
         "android.permission.INTERNET",
      },
   },
 
   plugins =
   {
 
      ["facebook"] =
      {
         -- required
         publisherId = "com.coronalabs",
         supportedPlatforms = { iphone = true, ["iphone-sim"] = true },
      },
   },
 
   plugins =
   {
      -- key is the name passed to Lua's 'require()'
      ["CoronaProvider.gameNetwork.google"] =
      {
         --required!
         publisherId = "com.coronalabs",
         supportedPlatforms = { android = true }
      },  
   },
}
---------

 

so the fcb_leaderboard is a scrollview in wich i will add scores of friends after the log in and the facebookconnect integer is to see if user logged in so it will be saved as 1 so each time the app start it will log in to Facebook automatically 

 

------------code---
local facebook = require( "facebook" )
local json = require( "json" )
local fbCommand = nil
local appId = "XXXXX"
 
 
 
function changemenu3()
    facebookconnect = 1 
   local facebookconnectFilename = "facebookconnect.data"       
  saveValue(facebookconnectFilename, tostring(facebookconnect) )
  connect_fcb.y = 100
  connect_fcb:prepare("disconnect")
  connect_fcb:play()
  fcb_leaderboard.x = 132
  cb_leaderboard.y = 270
end
 
 
function facebookListener(event)
  print( "Facebook Listener events:" )
 
            --
        if ( "session" == event.type ) then
            -- event.phase is one of: "login", "loginFailed", "loginCancelled", "logout"
--                    statusMessage.textObject.text = event.phase -- tjn Added
 
                    print( "Session Status: " .. event.phase )
 
                    if event.phase == "login" then
                      if(facebookconnect==0)then
                            changemenu3()
                          end
                    end
                    if event.phase == "logout" then
                    end
                    if event.phase == "loginFailed" then
                      function cancelfcbalert(event)
                        if(event.action=="clicked")then
                          if(event.index == 1)then
                            native.cancelAlert( alert )
                        end
                      end
                      alert = native.showAlert( "", "Facebook login error. Check connection or try again later.", { "Done" }, cancelfcbalert )
                    end
                  end
                    -- The following displays a Facebook dialog box for posting to your Facebook Wall
                 
        elseif ( "request" == event.type ) then
            local response = event.response
 
        elseif ( "dialog" == event.type ) then
 
        end
end
 
 
function connect_tofcb(event)
    if(event.phase=="began" and gamestart==false)then
      if(facebookconnect==0)then
        facebook.login( "XXXXXXXXX", facebookListener , { "public_profile","user_friends" }  )
    else
      function areyousurefcb( event )
       if(event.action=="clicked")then
        if(event.index==1)then
          facebook.logout( )
          facebookconnect = 0
  local facebookconnectFilename = "facebookconnect.data"       
  saveValue(facebookconnectFilename, tostring(facebookconnect) )
  connect_fcb.y = 250
  connect_fcb:prepare("connect")
  connect_fcb:play()
  fcb_leaderboard.x = 132
  fcb_leaderboard.y = 2000
        else
          native.cancelAlert( alert )
      end
      end
    end
    alert = native.showAlert( "", "Are you sure you want to disconnect from this Facebook account?", { "Yes", "No" }, areyousurefcb )
end
end
end
 
connect_fcb:addEventListener("touch", connect_tofcb )
 

please help



[TOPIC: post.html]
#71

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi @marc.jd,

According to your code, you have 2 "plugins" blocks in your build.settings. So you're not including the Facebook plugin at all, because you overwrite it with the "gameNetwork-google" one. Please correct this and test some more.

 

Best regards,

Brent



[TOPIC: post.html]
#72

appstore3

[GLOBAL: userInfoPane.html]
appstore3
  • Observer

  • 5 posts
  • Corona SDK

Hi Brent,

 

Did you get chance to look at my problem above? For your ready reference, I am attaching it here:

 

Hi Guys,

 

I am making a game for iOS. I have integrated Facebook login and score share functionality in this. I have a problem that if I login my game through facebook's developer id and click fb button to share score, login works well and score share also works perfectly fine with showDialog() function.

But if I use any other Facebook account to login, login goes fine but score share crashes and gives me following error in crash log:

 

    The operation couldn’t be completed. (com.facebook error 123.) corona

 

Please help. Urgently need some help. Thanks in advance.

 

Please provide some solution in urgent.



[TOPIC: post.html]
#73

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,328 posts
  • Corona Staff

Hi @appstore3, you need to provide more information than I'm having a problem.

 

What version of Corona SDK are you using?

What platform are you building on?

What device are you building and testing on?

What messages are in your device's console log beyond the one you published?

 

Have you googled what com.facebook error 123 means?  There will likely be plenty of hits on that on Stackoverflow from other platforms that might give you a hint as to whats going on.

 

Have you read @schizoid2k's post above?  Generally if it works for your developer account, but not someone else's, then your app is considered a test app and will only work for your defined test accounts.  Facebook has seriouslly restricted what apps can do on their service and apps that need extra features are required to be approved by Facebook before you can get those features. 

 

Rob



[TOPIC: post.html]
#74

felipebotero

[GLOBAL: userInfoPane.html]
felipebotero
  • Observer

  • 6 posts
  • Corona SDK

Hi Rob,

 

I have a problem with facebook v2 login flow with extended permissions.

There are 4 states:

1. User has no permission
I can ask user to give permissions to app, throug facebook.login function().

2. User accept basic info, but "skip" extended permissions
I can ask user again to give permissions to app, throug facebook.login function().

3. User accepts basic/extended permissions
All works fine.

4. In API v2, facebook introduces possibility to "deny" permissions to app (Different from skip). <-- PROBLEM
In this case, in the Facebook API there is a param called "auth_type: rerequest" that need to be sent in login process, so app can aks user for those permissions again.

Currently, is there a way in corona to do that "rerequest"?
I have tried everything, denied extra permissions are never asked again.

Sorry for my basic english.
Thank you



[TOPIC: post.html]
#75

marc.jd

[GLOBAL: userInfoPane.html]
marc.jd
  • Observer

  • 14 posts
  • Corona SDK

hello am trying to do a friends score board in a corona game so i have some questions

how to decode friends score with rank and name once requested as facebook.request( appID .. "/scores") and does this request givethe signed in user his score too ??




[topic_controls]
Page 3 of 4 1 2 3 4
 
[/topic_controls]