An Android Library used to Sign in Google, Facebook.
A library designed to use Oauth 2.0 easily
Simple OAuth Login!
Super simple, super easy to use!
Using Gradle
Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.rohjk:SimpleOAuth:1.2'
}
- In AndroidManifest.xml :
Nothing
- In Activity :
set Google OAuth 2.0 'Web Client ID', Facebook 'App ID'
SimpleSession.setAuthProvider(IdpType.GOOGLE,"<OAuth 2.0 Web Client ID>");
SimpleSession.setAuthProvider(IdpType.FACEBOOK,"<App ID>");
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
SimpleSession.onActivityResult(requestCode,resultCode,data);
}
IdpType idpType; // IdpType.GOOGLE or IdpType.FACEBOOK
SimpleSession.login(this, idpType, new SimpleAuthResultCallback<Void>() {
@Override
public void onResult(SimpleAuthResult<Void> result) {
if(result.isSuccess()){
//Success to Login!
}else{
//Fail to Login!
int errorCode = result.getErrorCode();
String errorMessage = result.getErrorMessaage();
}
}
});
SimpleSession.isSignedIn(<Activity>);
SimpleSession.getCurrentIdpType();
SimpleSession.getAccessToken();
SimpleSession.getEmail();
SimpleSession.logout();
play-services-auth:16.0.1 , facebook-android-sdk:4.+