Creating an Uber Clone - Part XXXIII - Transcript.pdf
1. Creating an Uber Clone - Part XXXIII
We already prepared a lot of the groundwork for social login on the server but didn't finish all the pieces so before I step into the client side changes needed for social
login lets discuss some of the required server side work.
2. public boolean existsByFacebook(String fb) {
List<User> us = users.findByFacebookId(fb);
return !us.isEmpty();
}
public boolean existsByGoogle(String google) {
List<User> us = users.findByGoogleId(google);
return !us.isEmpty();
}
UserService (Server)
I had to include support for the exists functionality that works based on a social token
3. @RequestMapping(method=RequestMethod.GET,value = "/exists")
public @ResponseBody boolean exists(String v) {
return users.existsByPhone(v);
}
@RequestMapping(method=RequestMethod.GET,value = "/existsFacebook")
public @ResponseBody boolean existsFacebook(String v) {
return users.existsByFacebook(v);
}
@RequestMapping(method=RequestMethod.GET,value = "/existsGoogle")
public @ResponseBody boolean existsGoogle(String v) {
return users.existsByGoogle(v);
}
UserWebservice
I also had to include a similar call in the UserWebservice class. I also have a smaller subtle change to the regular exists method. The argument name was phone and is
now v which means I can invoke all 3 webservices with very similar code on the client side.
That's it, pretty much everything else was already done.
11. keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS
-keystore YOUR_RELEASE_KEY_PATH
| openssl sha1 -binary | openssl base64
Facebook Android Wizard
The Android wizard has one task that is a bit challenging but other than that it should be trivial.
Before we begin we need to generate key hashes for facebook which need to be done on your development machine. To do that you will need a command line with the
JDK's bin directory in your path. You will also need the path to the Android keystore you use for signing. You can find this file in the Android signing section in Codename
One Settings. If there is no certificate file there make sure to generate it.
Once all of this is in place you can use this command for Linux/Mac. This will provide the SHA1 key you will need in the Android wizard.
12. keytool -exportcert -alias androiddebugkey -keystore
"C:UsersUSERNAME.androiddebug.keystore" |
"PATH_TO_OPENSSL_LIBRARYbinopenssl" sha1 -binary |
"PATH_TO_OPENSSL_LIBRARYbinopenssl" base64
Facebook Android Wizard
Similarly on windows the command follows a similar structure but uses Windows command line conventions. Now that this is out of the way lets go over the Android
wizard steps