stormpath-sdk-android icon indicating copy to clipboard operation
stormpath-sdk-android copied to clipboard

Social Login

Open omgitstom opened this issue 9 years ago • 4 comments

  • [x] Facebook
  • [x] Google
  • [ ] Github
  • [ ] LinkedIn

omgitstom avatar Feb 16 '16 16:02 omgitstom

Each social login will be setup as a separate module so that they can be included by developers only as needed. This will help reduce the method count to only those as needed.

dogeared avatar Feb 23 '16 16:02 dogeared

Steps:

  • Include Stormpath Base SDK in build
  • Include Social Provider SDK in build
  • Use the SDK in code

If the Social Provider SDK isn't in build, the runtime error should report a meaningful error


Need to prototype a few of these to get a handle on the pros and cons

omgitstom avatar Mar 01 '16 20:03 omgitstom

https://developers.facebook.com/docs/facebook-login/android

Different versions of the android Facebook SDK have different variations of the implementation instructions. The commonality is that there are callbacks provided by the Facebook SDK that allow you to get the user information and access tokens.

Such as this: // Callback registration loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { // App code }

    @Override
    public void onCancel() {
        // App code
    }

    @Override
    public void onError(FacebookException exception) {
        // App code
    }
});    

In the onSuccess method, the loginResult function contains the accessToken, so the App Code should be the Stormpath API call here.

https://developers.facebook.com/docs/reference/android/current/class/LoginResult/

The accessToken can be used to get additional graph API information about the user

ericlw avatar Mar 01 '16 22:03 ericlw

facebook implementation example added here 85850c51154ae679ee57dae7d852a8592e8effd4

ericlw avatar Mar 10 '16 23:03 ericlw