facebook login Corona

Well you seem to have gotten past the keyhash problem. Now your code is wanting to work with the old plugin and it needs updated to the new version. Please see the migration guide and adjust your code to the new way the plugin works.

Rob

Hello Rob!

 

The problem is that it does not work in all cases.

Only the first time that you press it posted on facebook but other times it does nothing and gives no error.

 

On the other hand , I want to make a screenshot when the game is over and the results are shown and that capture upload it to facebook.

So:

   1. I use this statement to make screenshot : local capture = display.captureScreen()

   2. The capture is saved in the pictures folder on my device.

  1. To publish that captures on facebook I try to use this instruction: facebook.request( “me/photos”, “POST”, capture ) but does not work.

Also, I have tried using this:

 

local attachment = { message = “My score!<3”, source = { baseDir=system.DocumentsDirectory, filename= capture, type=“image” } }

facebook.request( “me/photos”, “POST”, attachment )

 

 

        

        And it does not work . the problem that i dont know how tell the baseDir value variable to take the image of the pictures folder on my device and also not to put in filename . Really do not know if this can be done …

 

 

In the facebook plugin documentation v4 I find nothing… I do not get it.

Can you write me a code example that I have to use please?

 

 

 

 

Thank you.

Tania.

 

You probably want to use display.save() instead. This will create an image in a known sandbox directory:

display.save( display.currentStage, { filename="screenshot.png", baseDir=system.TemporaryDirectory, captureOffscreenArea=true, backgroundColor={0,0,0,0} } ) local attachment = { message = "My score!\<3", source = { baseDir=system.TemporaryDirectory, filename="screenshot.png", type="image" } } facebook.request( "me/photos", "POST",&nbsp;attachment&nbsp;)

Hello Rob,

 

I want to thank the help.

I want to ask one thing. In my code when you win a game in the end the box scores appears and also the button which you can share on facebook that score appears. 

 

The first time you press the button to share on facebook , share the image with the result without problems but later when you want to share the result of another level it is locked and the app stops.

 

 

I do not know if it is because the screenshot is always kept with the same name or the problem is in my code … please can you help me? this is the code:

 

 

local botonfb =  display.newImage(“images/fact.png”)

   botonfb:setReferencePoint ( display.CenterReferencePoint )

   botonfb.x = imgRecords.x  

   botonfb.y = lbLifes.y + 90

   pause:insert ( botonfb )

local function listener( event )

      

       print( “event.name:” … event.name )  --“fbconnect”

       print( "isError: " … tostring( event.isError ) )

       print( "didComplete: " … tostring( event.didComplete ) )

       print( “event.type:” … event.type )  --“session”, “request”, or “dialog”

       if(event.phase == “release”) then

           facebook.login( appId, listener )

       end

       if ( “session” == event.type ) then

           --options are “login”, “loginFailed”, “loginCancelled”, or “logout”

           if ( “login” == event.phase ) then

               display.save( display.currentStage, { filename=“screenshot.png”, baseDir=system.TemporaryDirectory, captureOffscreenArea=true, backgroundColor={0,0,0,0} } )

                local attachment = { message = “This is my score achieved in Dogchild! <3 Can you get better?”, source = { baseDir=system.TemporaryDirectory, filename=“screenshot.png”, type=“image” } }

                facebook.request( “me/photos”, “POST”, attachment )

           end

           elseif ( “request” == event.type ) then

              print(“facebook request”)

            if ( not event.isError ) then

               local response = json.decode( event.response )

            end

           elseif ( “dialog” == event.type ) then

               print( “dialog”, event.response )

          

           end

end

local function loginFace( event )

       facebook.login( appID, listener, { “publish_actions”, “user_birthday” } )

end

botonfb:addEventListener( “touch” , loginFace )

As always thank you very much.

Tania.

What would be more helpful is the contents of your console log. 

Rob

this is the console 

Tania

The Facebook V4 plugin does not require an AppID as the first parameter. It expects the listener function as the first parameter. You also have AppId one place and AppID another, which could have been a problem with the old plugin.  Remove the Appid’s from your facebook.login() calls and see if that changes things.

Rob

Can you try again? We have tweaked something on our servers that should fix this. It may take a few minutes to propagate through all of the servers.

Posts to main forum topics should be in English. We have a forum specific for Spanish speakers where you can ask questions in Spanish.

Thanks

Rob

Hello thank you very much.

I test well with com.coronalabs ? or I have to change something in build.settings?

Best regatas!

Your build.settings looks fine.

Are you still getting the error?

Rob

Hi i´m Tania_gh2000 from other account . i cant access to my account i dont understand.

The first time I’ve tried has worked perfectly but the second has left me this error message :

"Invalid key hash. The key hash icbj8sAOK4GRJ2jHI3En5zdH2Ss= does not match any stored key hashes. Configure your app key hashes at http://developers.facebook.com/apps/902543416507297 "

I had already generated my key hash why ask me that now?my key hash is diferent.

Can you help me?

Thank you very much .

Regards

tania [10:57 AM] the first time I’ve tried has worked perfectly but the second test has left me this error message I sent in the image.
I had already generated my key hash why ask me that now? you can help me thank you very much .

the first time I’ve tried has worked perfectly but the second time I see this error :

"Invalid hash key . The key hash xxxxxxxxxxxxxxxxxxx = " does not match

any stored key hashes. Configured your app key hashes at

http://developer.facebook.com/app/902xxxxxxxxx

I have already generated a hash key and is not the same

can you help me?

Thanks, regards

Tania.

Please read: https://docs.coronalabs.com/guide/social/setupFacebook/index.html#android

under Key Hashes.

Basically Facebook tells you what it’s expecting. Take what they put in the console log, make any changes per the document above and add that new string to your FB developer portal, removing any other keyhashes.

Rob

I’m worried … sorry .

I copied the hash key that appears in the error message and have put in the box hash key settings facebook developers .
I have also enabled a single sign-on and deep link and native application. package name as I have in the crown and the name of the class com.ansca.corona.CoronaActivity
but I still  the same error message . (
Please help me!

Did you change the two special characters that need changed as documented in the link I provided?  Can you provide a screen shot from your developer platform and the exact message in your console log?

Rob

Yes ofcourse, i dont know the mistake. 

here you can see the pics .

Thanks

Best regards,

Tania.

do I have to change ?

You need to use the “adb logcat” command with your device tethered to your PC and look for the error there. It will tell you what you need to provide for the hash key. If you don’t have the android developer tools installed, then read the guide below

http://docs.coronalabs.com/guide/basics/debugging/index.html

I need to see the error message in the console log.

Rob

Hi Rob,

 

I have already installed the tools to use adb logcat. 

 

The problem is that I find the hash key . What I can do? I`m blocked.

 

Thanks for your help.

Tania.

 

There should be text in the console log from Facebook that tells you that the hash key is bad. It should also tell you what it should be.  I need to see that text.

Rob

Hi Rob!

I downloaded and installed the android tools. I connected my mobile phone to my computer and i have started the console using the command adb logcat.

The result i have saved in the text file called “ErrorClave.txt”.

I can not find the error message with the hash key.

I attached the results so you can  help me.

Thanks!!

Tania.

I attached the results so you can help me.

.I downloaded and installed the android tools . I connected my mobile phone to your computer and have started the console using the adb logcat command. The result I have saved in the text file called " ErrorClave.txt " . I can not find the error message with the hash key .
I downloaded and installed the android tools . I connected my mobile phone to your computer and have started the console using the adb logcat command. The result I have saved in the text file called " ErrorClave.txt " . I can not find the error message with the hash key .

I downloaded and installed the android tools . I connected my mobile phone to your computer and have started the console using the adb logcat command. The result I have saved in the text file called " ErrorClave.txt " . I can not find the error message with the hash key .

I downloaded and installed the android tools . I connected my mobile phone to your computer and have started the console using the adb logcat command. The result I have saved in the text file called " ErrorClave.txt " . I can not find the error message with the hash key .

I downloaded and installed the android tools . I connected my mobile phone to your computer and have started the console using the adb logcat command. The result I have saved in the text file called " ErrorClave.txt " . I can not find the error message with the hash key .