stormpath / stormpath-sdk-android

Android library for Stormpath
http://www.stormpath.com
Apache License 2.0
18 stars 15 forks source link

Social Login #3

Open omgitstom opened 8 years ago

omgitstom commented 8 years ago
dogeared commented 8 years ago

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.

omgitstom commented 8 years ago

Steps:

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

ericlw commented 8 years ago

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() { @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 commented 8 years ago

facebook implementation example added here 85850c51154ae679ee57dae7d852a8592e8effd4