Supersonic and Facebook login plugin


#1

So a few bits trying to install the Facebook login plugin, with Steroids 4.0.2


https://academy.appgyver.com/categories/16-steroids-addons/contents/134-facebook-addon-usage

There seem to be a couple of files that no longer exist in that guide (outdated). The bit where it says to add…


<feature name="http://appgyver.com/steroids/addons/facebook">
    <param name="enabled" value="true" />
</feature>

… to the www/config.xml as the whole www dir no longer exists, and in dist its only showing the android and ios configs, but no general one.

Also it says to add steroids.addons.js to the head of your layout, but that file doesn’t seem to exist yet either.

I notice the facebook section is no longer in the kitchensink for supersonic, but has anyone got facebook login working yet?


#2

Very odd, got it semi working. It lets me login the first time fine, give FB permission, go back to the app…

But if I try to login a second time, it says


Invalid key hash. The key hash Y0Aw67z++D+4YUWo8G/G1tak1L4 does not match any stored key hashes. Configure your app key hashes at...

Now the key hash Y0Aw67z++D+4YUWo8G/G1tak1L4 doesn’t match anything I have generated with the keytool as far as I can see. Also that hash is only 27 characters long so not even a valid hash, when I try and add it as a keyhash it won’t let me.

So strange it works once and not again… any ideas? The only way to make it work again is to remove app perms from my facebook account and login again.


#3

as a question… where did you find that error output ? because i’m struggling with the cordova-facebook plugin myself right now… :wink: btw… if you just put that hash into your facebook-android section it should work … as a quick n dirty fix :wink:


#4

I wrote a few blog posts about it… http://infomatrix-blog.herokuapp.com/tag/appgyver

I’m using the Firebase Simple Login for this, which is much more mature and easy to work with IMO. Would love to see a login recipe for the Facebook Addon as well in another post :slight_smile:


#5

That error outputs actually in facebook. So if I goto the app, press login, give it permissions etc. Come back, try to login with facebook again, it sends me to facebook with that in a red alert at the top of the page.

and how do you mean put that hash into my facebook-android section? in the app configuration? Can you show me an example of what you mean? I already have the plugin variables defined as in the old guide (linked above), and also the custom protocol bit.


#6

got it to work for me… at least i posted something using the share-dialog… still having trouble with the feed-dialog, but thats on the facebook side…

  1. what i meant is … you take the key hash, that it says didnt match - and put this into fb’s developerdashboard under settings into your “android” section… quick n ugly but should work :wink:

  2. i managed to do it this way… i created a new keystore with

 
keytool -genkey -v -keystore <yourkeystorename>.keystore -alias androiddebugkey

the password for the alias must be ‘android’ (don’t ask me why… it’s what i found somewhere)

and now generate a key-hash for facebook from it with

 
keytool -exportcert -alias androiddebugkey -keystore <yourkeystorename>.keystore | openssl sha1 -binary | openssl base64

now you can setup that newly generated keyhash in fb’s developer dashboard (->settings/android) again and now - at least for me- the cordovaFacebook plugin works… :slight_smile: (on android that is… i didn","t test it anywhere else so far)

ah… and in order to develop with this… you have to create a scanner-build which uses that keystore obviously and includes the cordova plugin…


#7

and as for the plugin i use… i used https://github.com/Wizcorp/phonegap-facebook-plugin in the build… just saw you used something else…


#8

Hi Christof, could you please write a post about it or perhaps share a repo showing off your approach, perhaps with the README outlining the process step by step :slight_smile:

I’m trying to build a library/utility components for a composable Hybrid Auth at https://github.com/kristianmandrup/hybrid-auth

Also writing a blog post… http://infomatrix-blog.herokuapp.com/post/appgyver-initial-page-login
Cheers! I have yet to add the cordova plugin to my build and try it out…


#9

Chris and Christof, could any of you guys who got this thing working do a writeup of the steps required for Steroids 4.x. Thanks :slight_smile:


#10

here you go… http://christofklaus.de/2014/12/11/supersonic-and-cordova/
more detailed shouldnt be necesary i guess ^^


#11

great work guys, thanks.

PS, I presume the keystore isn’t necessary for IOS?


#12

i only covered the android-side so far… but no, no keystore for ios afaik…


#13

Hi @Christof yes I tried adding that to my FB keys, but as mentioned in OP, it wouldn’t let me because its only 27 characters instead of 28, I have no idea where that key is actually coming from :stuck_out_tongue: So not surprised its failing

And will give it another go, I put down the FB side of things at the mo, working on the REST api and integrating it in, so once I have some structure to start properly holding users I will get back onto it :slight_smile:

Thanks!


#14

hehe… yea - there are quite a few pitfalls in trying to get that to work… anyways its all detailed in my blogpost so, when you get back to it, you shouldnt have a lot of trouble now anymore :wink:


#15

Wauw!!! So awesome, can’t wait do dig into it tmrw :slight_smile: Thanks a lot maestros!!!


#16

I still have the same issue, tried it on a completely different app, started again, and logs me in first time but then if I logout, and try to log back in again, it gives me the same message, with some random key that is only 27 characters long, and wont allow me to enter it in the key hashes section?!

I am using this for the login / logout https://github.com/AppGyver/phonegap-facebook-plugin/blob/master/www/index.html

Even tried it logging in with another FB account, so its not just mine being wierd

@Christof, can you just confirm if the logout / login again works for you?


#17

@chris… as i said, i don’t use that plugin. read the blogpost to see how you can do it.
and i guess, before you don’t get that thing with the keyhash right, ‘weird’ behaviour is to be expected whatever kind of plugin/account you’re using… your app has to be built with that keystore and an alias of androiddebugkey as far as i could find out… the password for that must be ‘android’ … it’s all detailed in the post.

personally i didn’t use the logout-feature so far… i did login, grant permissions for the app, share a link via feeddialog of facebooks api…


#18

Where do I add the Key hash? (see my comment in your blog post). Thanks.


#19

you have to add the keyhash to your facebook application on fb… (developers.facebook.com)
developer-dashboard -> settings -> android

if there isnt an android section, click “add platform” -> android…
then you’ll have two fields… “google play package name” and “Key Hashes”…
the package name is the same as what you chose when building your app like "com.something.someapp"
and the Key hash goes into …wait for it… the “Key Hashes” field!!


#20

Sure, I understand the Key hashes part. I’ve been trying to deploy a fork of the kitchensink app, so I didn’t choose the name of the app myself. Which is why I wasn’t sure what the package name was or if I could just use the key instead somehow…