WindSekirun / SocialLogin

[Deprecated] It provides integrated social login feature which have facebook, naver, kakao, line, twitter, google.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deprecated

On 2018. 07. 11, this library has deprecated. Please use enhance version of SocialLogin, RxSocialLogin

SocialLogin

GitHub license

It provides integrated social login feature which have facebook, naver, kakao, line, twitter, google.

If you are korean, please see this README

Usages

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'
}

Available Feature

Service logout Return Data Config
Facebook O ID, NAME, EMAIL, PROFILE_PICTURE, GENDER, FIRST_NAME setRequireEmail, setRequireWritePermission, setApplicationId, setRequireFriends, setBehaviorOnCancel, setPictureSize
Google 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
Twitter X ID, NAME setConsumerKey, setConsumerSecret

Guide

Common

It can be copy-paste cause each serivce has same constructure.

Declare xxxLogin variables to use

private KakaoLogin kakaoModule;

generate new instance of xxxLogin

kakaoModule = new KakaoLogin(this, new OnResponseListener() {
    @Override
    public void onResult(SocialType socialType, ResultType resultType, Map<UserInfoType, String> map) {

    }
});

Login

kakaoModule.onLogin();

execute when onDestroy

kakaoModule.onDestroy();

execute when onActivityResult

kakaoModule.onActivityResult(requestCode, resultCode, data);

Description of enums

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 ...
}

Kakao Login

Dependencies

repositories {
    maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
}
  implementation 'com.kakao.sdk:usermgmt:1.11.1'

Add api key to AndroidManifest.xml

 <meta-data
            android:name="com.kakao.sdk.AppKey"
            android:value="<YOUR-API-KEY>"/>

initialize into Application

SocialLogin.init(this);
KakaoConfig kakaoConfig = new KakaoConfig.Builder()
                .setRequireEmail()
                .setRequireNickname()
                .build();
		
SocialLogin.addType(SocialType.KAKAO, kakaoConfig);

using in activity

private KakaoLogin kakaoModule;

Facebook login

add dependencies

   implementation 'com.facebook.android:facebook-android-sdk:4.23.0'

add activity into AndroidManifest.xml

<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>"/>

initialize into Application

SocialLogin.init(this);
FacebookConfig facebookConfig = new FacebookConfig.Builder()
                .setApplicationId("<YOUR-API-KEY>")
                .setRequireEmail()
                .build();
		

SocialLogin.addType(SocialType.FACEBOOK, facebookConfig);

using in activity

private FacebookLogin facebookModule;

Naver Login

add dependencies

implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')

initialize into Application

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);

using in activity

private NaverLogin naverModule;

Line Login

add dependencies

implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')

initialize into Application

SocialLogin.init(this);
LineConfig lineConfig = new LineConfig.Builder()
                .setChannelId("<YOUR-API-KEY>")
                .build();


SocialLogin.addType(SocialType.LINE, lineConfig);

using in activity

private LineLogin lineModule;

Twitter Login

add dependencies

    implementation 'com.twitter.sdk.android:twitter:3.1.0'

initialize into Application

SocialLogin.init(this);
TwitterConfig twitterConfig = new TwitterConfig.Builder()
                .setConsumerKey("<YOUR-API-KEY>")
                .setConsumerSecret("<YOUR-API-KEY>")
                .build();


SocialLogin.addType(SocialType.TWITTER, twitterConfig);

using in activity

private TwitterLogin twitterModule;

Google Login

Pre TODO

put your google-services.json in app module which can get at Google Sign-in for Android

add dependencies

    implementation 'com.google.android.gms:play-services-auth:10.2.6'

initialize into Application

SocialLogin.init(this);
GoogleConfig googleConfig = new GoogleConfig.Builder()
                .setRequireEmail()
                .build();


SocialLogin.addType(SocialType.GOOGLE, googleConfig);

using in activity

private GoogleLogin googleModule;

License

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.

About

[Deprecated] It provides integrated social login feature which have facebook, naver, kakao, line, twitter, google.

License:Apache License 2.0


Languages

Language:Java 93.6%Language:Kotlin 6.4%