android / identity-samples

Multiple samples showing the best practices in identity on Android.
Apache License 2.0
366 stars 221 forks source link

Use with facebook SDK #2

Closed codingjeremy closed 4 years ago

codingjeremy commented 5 years ago

Issue by mypplication Monday Dec 28, 2015 at 11:25 GMT Originally opened as https://github.com/googlesamples/android-credentials/issues/6


Hello, I see that this API supports Facebook. But how to properly use with it? there have no technique to connect in "silent" with the Facebook SDK. Can you explain how we should use it ?

Thank you.

codingjeremy commented 5 years ago

Comment by samtstern Monday Jan 04, 2016 at 23:36 GMT


The intended usage of the Credentials API for non-password authentication (Google Sign-In, Facebook Log In, etc) is as a sort of "hint".

Imagine this scenario.

  1. A user gets your app on device A. She is presented with a screen with Facebook, Google, and Twitter login buttons. The user choose Facebook.
  2. Save a Credential to the API that just has the user's name/email and "Facebook" as the account type.
  3. The same user gets a second device (a tablet, for instance) and downloads your app again. To your app this is a brand new user, but the Credentials API will recognize the user and return the Facebook credential. This means you can skip the login screen and pretend that the user hit the Facebook sign-in button since you know that is their preference (or show a screen with just that option, to reduce confusion).

What are the benefits of this?

  1. Users will not have to see your whole login flow on every device.
  2. Users will not forget which identity option they chose, which will make their life easier and make it more likely that you can recognize users across devices.
  3. For providers that support some sort of "silent" sign-in option (like Google) you can get zero-click cross-device sign-in.