Google Identity Toolkit and facebook

553 views Asked by At

I am developing an application for android that will leverage google identity toolkit for authentication. Furthermore, the tokens obtained from the authentication will be used by an intermediate server to retrieve friend lists from the due social networks used to authenticate (e.g. Facebook). For this, I assume I need an OpenID of Web application retrieved from Google developer console, am I right? And then, the intermediate server would have a rest api for the android application to contact and perform logins?

On Facebook, am I supposed to configure two distinct applications? One for web and another for android.

The architecture would be something like: enter image description here

Kind regards

1

There are 1 answers

1
Jin Liu On

You only need to create one application at Facebook, but the application should contain two platforms (one is Android, the other is web). See https://developers.google.com/identity/toolkit/android/quickstart#optional_step_4_facebook_integration for the instruction.

In your Android app, you can add desired scopes when initializing the GitkitClient using GitkitClientBuilder.addScopes(IdProvider.FACEBOOK, Arrays.asList("user_friends")). See https://developers.google.com/identity/toolkit/android/reference/com/google/identitytoolkit/GitkitClientBuilder for the API reference.

After the user signs into your Android app, you can get the Facebook access token using Session.getActiveSession().getAccessToken(), and sends the access token to your server. Your server can then call Facebook Graph API with that access token.