On 2018. 07. 11, this library has deprecated. Please use enhance version of SocialLogin, RxSocialLogin
It provides integrated social login feature which have facebook, naver, kakao, line, twitter, google.
If you are korean, please see this README
rootProject/build.gradle
allprojects {
repositories {
maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
maven { url 'https://jitpack.io' }
}
}
app/build.gradle
dependencies {
implementation 'com.github.WindSekirun:SocialLogin:1.2.5'
}
Service | logout | Return Data | Config |
---|---|---|---|
O | ID, NAME, EMAIL, PROFILE_PICTURE, GENDER, FIRST_NAME | setRequireEmail, setRequireWritePermission, setApplicationId, setRequireFriends, setBehaviorOnCancel, setPictureSize | |
O | ID, NAME, EMAIL, ACCESS_TOKEN | setRequireEmail | |
Kakao | O | ID, NICKNAME, EMAIL, PROFILE_PICTURE, THUMBNAIL_IMAGE, AGE_RANGE, BIRTHDAY, GENDER, EMAIL_VERIFIED | setRequireEmail, setRequireAgeRange, setRequireBirthday, setRequireGender |
Line | X | ID, NAME, ACCESS_TOKEN | setChannelId |
Naver | O | ID, NAME, EMAIL, NICKNAME, GENDER, PROFILE_PICTURE, AGE, BIRTHDAY | setAuthClientId, setAuthClientSecret, setClientName |
X | ID, NAME | setConsumerKey, setConsumerSecret |
It can be copy-paste cause each serivce has same constructure.
private KakaoLogin kakaoModule;
kakaoModule = new KakaoLogin(this, new OnResponseListener() {
@Override
public void onResult(SocialType socialType, ResultType resultType, Map<UserInfoType, String> map) {
}
});
kakaoModule.onLogin();
kakaoModule.onDestroy();
kakaoModule.onActivityResult(requestCode, resultCode, data);
public enum SocialType { // type of social providers
KAKAO, GOOGLE, FACEBOOK, LINE, NAVER, TWITTER;
}
public enum ResultType {
SUCCESS, FAILURE, CANCEL;
}
public enum UserInfoType { // field of information of user.
ID, NAME, ACCESS_TOKEN, EMAIL, NICKNAME, PROFILE_PICTRUE, GENDER ...
}
repositories {
maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
}
implementation 'com.kakao.sdk:usermgmt:1.11.1'
<meta-data
android:name="com.kakao.sdk.AppKey"
android:value="<YOUR-API-KEY>"/>
SocialLogin.init(this);
KakaoConfig kakaoConfig = new KakaoConfig.Builder()
.setRequireEmail()
.setRequireNickname()
.build();
SocialLogin.addType(SocialType.KAKAO, kakaoConfig);
private KakaoLogin kakaoModule;
implementation 'com.facebook.android:facebook-android-sdk:4.23.0'
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value=""<YOUR-API-KEY>"/>
SocialLogin.init(this);
FacebookConfig facebookConfig = new FacebookConfig.Builder()
.setApplicationId("<YOUR-API-KEY>")
.setRequireEmail()
.build();
SocialLogin.addType(SocialType.FACEBOOK, facebookConfig);
private FacebookLogin facebookModule;
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
SocialLogin.init(this);
NaverConfig naverConfig = new NaverConfig.Builder()
.setAuthClientId("<YOUR-API-KEY>")
.setAuthClientSecret("<YOUR-API-KEY>")
.setClientName(getString(R.string.app_name))
.build();
SocialLogin.addType(SocialType.NAVER, naverConfig);
private NaverLogin naverModule;
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
SocialLogin.init(this);
LineConfig lineConfig = new LineConfig.Builder()
.setChannelId("<YOUR-API-KEY>")
.build();
SocialLogin.addType(SocialType.LINE, lineConfig);
private LineLogin lineModule;
implementation 'com.twitter.sdk.android:twitter:3.1.0'
SocialLogin.init(this);
TwitterConfig twitterConfig = new TwitterConfig.Builder()
.setConsumerKey("<YOUR-API-KEY>")
.setConsumerSecret("<YOUR-API-KEY>")
.build();
SocialLogin.addType(SocialType.TWITTER, twitterConfig);
private TwitterLogin twitterModule;
put your google-services.json in app module which can get at Google Sign-in for Android
implementation 'com.google.android.gms:play-services-auth:10.2.6'
SocialLogin.init(this);
GoogleConfig googleConfig = new GoogleConfig.Builder()
.setRequireEmail()
.build();
SocialLogin.addType(SocialType.GOOGLE, googleConfig);
private GoogleLogin googleModule;
Copyright 2017 WindSekirun (DongGil, Seo)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.