An Android Library that provides social login for 15 platforms within by RxJava2, Kotlin and Firebase Authentication.

Overview

RxSocialLogin

Awesome Kotlin Badge

The license information for logo is located at the bottom of the document.

These instructions are available in their respective languages.

Introduction

An Android Library that provides social login for 15 platforms within by RxJava2, Kotlin and Firebase Authentication.

This library is an improved version of @WindSekirun 's SocialLogin library. It has the following differences.

  • The result delivery method has been changed to be passed through RxJava instead of the Listener.
  • Compared to the original written in Java, the improved version is written in Kotlin only.
  • Compared to the original supported 6 platforms, the improved version is support 15 platforms.
  • Provide Type-Safe builder with Kotlin DSL
  • All methods and code have been rewritten.
  • All code that are written in Kotlin but considered to be Java compatible.

Supported Platforms

Platform Data Version
Disqus id, name, email, nickname, profilePicture, accessToken 1.0.0
Facebook id, name, email, profilePicture, gender, firstName, accessToken 0.5.0
Foursquare id, name, email, firstName, gender, birthDay, profilePicture, accessToken 1.0.0
Github id, name, email, profilePicture, emailVerified, accessToken 1.0.0
Google id, name, email, profilePicture, emailVerified 0.5.0
Kakao id, name, email, profilePicture, thumbnailImage, ageRange, birthDay, gender, emailVerified 0.5.0
Line id, name, accessToken 0.5.0
LinkedIn id, name, email, profilePicture, firstName, accessToken 1.0.0
Naver id, name, email, nickname, gender, profilePicture, age, birthDay, accessToken 0.5.0
Twitch id, name, email, profilePicture, accessToken 1.0.0
Twitter id, name, nickname, email, profilePicture 0.5.0
VK id, name, email, profilePicture, nickname, firstName, birthDay 1.0.0
Windows id, name, email 1.0.0
Wordpress id, name, email, profilePicture, emailVerified, accessToken 1.0.0
Yahoo id, name 1.0.0

Click on the name of each platform to move to how to apply the platform.

Import

Add the following code to build.gradle in the root folder.

allprojects {
	repositories {
		maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
		maven { url 'https://jitpack.io' }
	}
}

Add the following dependencies to the build.gradle of the module you want to use.

dependencies {
	implementation 'com.github.WindSekirun:RxSocialLogin:1.2.5.4'
	// androidx
        implementation 'com.github.WindSekirun:RxSocialLogin:1.2.5.4-androidx'
    
	// RxJava
	implementation 'io.reactivex.rxjava2:rxandroid:lastest-version'
	implementation 'io.reactivex.rxjava2:rxjava:lastest-version'
}

RxJava is an active library, and you should always keep the latest version for new enhancements to take effect. Therefore, we recommend that you add RxJava to the bottom of the dependency.

  • RxAndroid:
  • RxJava:

Migrate from 1.0.0

1.1.0 has MASSIVE breaking changes you should know about that.

The following are major changes.

  • Migrate to Java Builder to DSL Builder
  • Initialize in RxSocialLogin as once
  • Call onActivityResult as once
  • Migrate receive result with RxSocialLogin.result()

Release Notes are here

Very easy 5-step usage

First, Initialize the module using ConfigDSLBuilder in Application class. ConfigDSLBuilder allows you to configure settings for each platform.

class MainApplication : Application() {

    override fun onCreate() {
        super.onCreate()

        initSocialLogin {
            facebook(getString(R.string.facebook_api_key)) {
                behaviorOnCancel = true
                requireWritePermissions = false
                imageEnum = FacebookConfig.FacebookImageEnum.Large
            }
        }
    }
}

Inside initSocialLogin block, you can use methods which have platform name such as facebook and google. All parameters except setup will necessary information to use SocialLogin feature.

setup parameter is function that provide generate platform config object(ex, FacebookConfig) and apply additional options such as behaviorOnCancel, imageEnum. It can be optional, but not nullable parameters.

Although ConfigDSLBuilder is Kotlin Type-Safe builders, but it has compatitable with Java language. we provide ConfigFunction with same feature with original setup higher-order function.

You can see full examples of ConfigDSLBuilder both in Kotlin and Java

Next, Call RxSocialLogin.initialize(this) in onCreate methods in Activity class before execute RxSocialLogin.result methods.

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    ...
    RxSocialLogin.initialize(this)
}

From 1.1.0, RxSocialLogin class will manage instance of Login object, so you don't need to care about initialization.

Next, Call RxSocialLogin.activityResult(requestCode, resultCode, data) in onActivityResult methods.

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent ? ) {
    super.onActivityResult(requestCode, resultCode, data)
    RxSocialLogin.activityResult(requestCode, resultCode, data)
}

Next, Call RxSocialLogin.result where you want the results. Outside of Activity will be fine.

RxSocialLogin.result()
    .subscribe({ item -> 

    }, { throwable ->

    }).addTo(compositeDisposable)

Final, Call RxSocialLogin.login(PlatformType.FACEBOOK) to start SocialLogin feature.

Instructions for use

Apply to Proguard

Please refer to Proguard rule of sample app.

Constraints - all actions should keep the main thread

Everything should work within the main thread. If library use a network inside the library, it will be handled correctly internally using Fuel, so the Observable returned by RxSocialLogin should keep the main thread. If it is not the main thread, login fails immediately.

In other words, the following cases are not processed and are treated as LoginFailedException immediately.

RxSocialLogin.result()
		.subscribeOn(Schedulers.io())
		.observeOn(AndroidSchedulers.mainThread())
		...

Due to this constraints, it is not allowed to start social login right after the network processing, such as flatMap. If you need to handle this case, it is better to call RxSocialLogin separately in subscribe after network processing.

Occurred OnErrorNotImplementedException

A common error is OnErrorNotImplementedException, which is not handled for onError at the time of subscribe

Occurred UndeliverableException

Based on 0.5.0 UndeliverableException occurs when Exception is not passed to onError. You can use RxJavaPlugins.setErrorHandler { e -> } to solve the problem, but this will change the overall behavior of RxJavaPlugins.

In 1.0.0 and later, LoginFailedException has been changed to inherit IllegalStateException to prevent this problem. Therefore, it is not intended to occur in later versions.

See Error handling for more details.

Targeting below of API 21

Currently(1.1.0), we support API 16 as minSdkVersion, but com.microsoft.identify.client:msal library support API 21 as minSdkVersion.

According issue #263 of AzureAD/microsoft-authentication-library-for-android, You can override this library to avoid conflicts of minSdkVersion.

Place this statement in AndroidManifest.xml to solve this conflicts. we hope microsoft solve this problem asap.

<uses-sdk tools:overrideLibrary="com.microsoft.identity.msal"/>

Author & Contributor

Issue Tracker receives a variety of issues including bug findings, improvements, and new platform additions. Pull Requests is always welcome.

License

  • The ReactiveX logo was taken from Seeklogo.
  • The font used for the logo is Hanken Design Co. Hanken round and this font follows SIL OFL. There is a PSD file for the logo in the project.
  • Copyright for the platform logo used in the sample exists in each company. The RxSocialLogin library is not associated with the platform company.
Copyright 2017 - 2018 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.
Comments
  • Duplicate class com.android.vending.billing.IInAppBillingService found in modules ?

    Duplicate class com.android.vending.billing.IInAppBillingService found in modules ?

    안녕하세요. 노고가 많으십니다. Duplicate class com.android.vending.billing.IInAppBillingService found in modules jetified-RichUtilsKt-2.3.1-runtime.jar (com.github.WindSekirun:RichUtilsKt:2.3.1) and jetified-library-1.0.44.jar (com.anjlab.android.iab.v3:library:1.0.44) 이거 어떻게 해결하는지 몰겠는데... 좀 도와주시면 안되나요? com.anjlab.android.iab.v3:library:1.0.44 이걸로 인앱결제 추가 해놨는데 두개 동시에 못쓰는건가요? 소셜로긴인데 왜 IInAppBillingService 부분이 문제가 될까요? 초보라 잘부탁듸립니다.

    good first issue 
    opened by raykang49 9
  • Not getting result after login

    Not getting result after login

    For facebook login not getting result RxSocialLogin.result(this).subscribe({ Timber.d { "FirstName: ${it.firstName}" } }, { Timber.e(it.cause)}) After onActivityResult.

    bug 
    opened by dkk009 4
  • google login crash onActivitiyResult

    google login crash onActivitiyResult

    It seems the google authentication, doesnt seem to work. Please is there anything that i might be doing wrong. i have also enabled the option on firebase and produced a debugged version of the SHA1 hash key. i also downloaded the google services json in my project. Please what can i be doing wrong that it calls back with Google sign in failed

    question 
    opened by dogeri28 4
  • Simplify RxSocialLogin.** methods into one methods

    Simplify RxSocialLogin.** methods into one methods

    Affect Version: 1.1(Remove) Currently there are separate methods for each platform, so there is a lot of work to be done when adding a new platform.

    In addition, we already provide platform information in LoginResultItem, so we do not need any distinction in Observable.

    enhancement breaking change 
    opened by WindSekirun 3
  • Notification from Google Play

    Notification from Google Play

    I received notification from Google Play:

    Your application uses a WebView component that is vulnerable to cross-scripting. Detailed information can be found in this article. Vulnerable classes: com.kakao.auth.authorization.authcode.KakaoWebViewActivity-> initUi Fix the problem before: 03/18/2020

    gradlew client-v3:dependencies shows that this class from RxSocialLogin library:

    +--- com.github.WindSekirun:RxSocialLogin:1.2.5.3-androidx
    |    ...
    |    +--- com.kakao.sdk:usermgmt:1.14.0
    |    |    \--- com.kakao.sdk:auth:1.14.0
    |    |         +--- com.kakao.sdk:network:1.14.0
    |    |         |    \--- com.kakao.sdk:util:1.14.0
    |    |         \--- androidx.fragment:fragment:1.0.0 -> 1.1.0 (*)
    |    ...
    
    bug enhancement 
    opened by feivur 2
  • Not getting Facebook access token from success result

    Not getting Facebook access token from success result

    Not getting facebook access token after success full login, apart access token every thing is coming properly.

    FirstName: ***** FacebookId:22********** FacebookAccessToken:

    enhancement 
    opened by dkk009 2
  • Migrate with RxActivityResult

    Migrate with RxActivityResult

    Since some SDKs handle them internally, this feature is not 100% supported. But if platform support it, it will implement the feature as much as possible.

    opened by WindSekirun 2
  • Fails to build when Proguard is enabled

    Fails to build when Proguard is enabled

    Hello,

    Please can you verify that your library can be built with Proguard enabled, as when i comment the library my project builds fine with proguard, but when i then include the rxsocial login it doesnt.

    Regards Sunny

    opened by dogeri28 2
  • User has cancelled the job.

    User has cancelled the job.

    i got an exception when i try to login with google says:

    com.github.windsekirun.rxsociallogin.intenal.exception.LoginFailedException: User has cancelled the job.

    any help please?

    opened by abualgait 1
  • I can't run demo app, There's no google-services.json file here.

    I can't run demo app, There's no google-services.json file here.

    My demo build is failed with error message like this.

    Execution failed for task ':demo:processDebugGoogleServices'.
    > File google-services.json is missing. The Google Services Plugin cannot function without it. 
       Searched Location: 
      /Users/sinseungmin/AndroidProject/RxSocialLogin/demo/src/debug/google-services.json
      /Users/sinseungmin/AndroidProject/RxSocialLogin/demo/google-services.json
    

    How can I play demo? Do I have to put on my own google-service.json there? Or Is it just kind of bug?

    opened by greedy0110 1
  • 🐛 KakaoLogin has only one sessionCallback

    🐛 KakaoLogin has only one sessionCallback

    Problem

    KakaoLogin.login: create new sessionCallback instance and add sessionCallback using addCallback

    And It doesn't clear. So, multiple callbacks are registered in same time.

    ChangeLog

    KakaoLogin.login()'s logic is changed.

    As-is

    1. create new sessionCallback instance
    2. add callback

    To-be

    1. if it already has sessionCallback instance, then removeCallback
    2. create new sessionCallback instance
    3. add callback
    enhancement good first issue 
    opened by greedy0110 1
  • Crash when opened the app due to not updated sdks

    Crash when opened the app due to not updated sdks

    Rejecting re-init on previously-failed class java.lang.Class<com.google.firebase.auth.FirebaseAuth>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/internal/InternalTokenProvider;

    opened by Abdelsattar 2
  • Plan of 1.3.0

    Plan of 1.3.0

    It has been a long time since I had planned.

    RxSocialLogin 1.3.0 will cover these feature.

    • New Platform: Discord, Bitbucket, Gitlab, Amazon, ~Paypal~, Facebook Account Kit, Instagram (#20, #22, #23, #24, #25, #41, #43) and more..?
    • Resolve error on GoogleLogin in Fragment (#44)
    • New sample application design (#49)
    • ~Use RxSocialLogin without RxJava~ -> In 1.5.0

    Also, RxSocialLogin will remove support of the non-androidx project in 1.3.0. That means all new version above 1.3.0 will provide only androidx version. But you can use 1.2.1 if you want to continue this library in the non-androidx project.

    Any suggestions or questions are welcome.

    Todos

    • [x] Discord
    • [x] Bitbucket
    • [x] Gitlab
    • [x] Amazon
    • [x] ~Paypal~
    • [ ] Facebook Account Kit
    • [x] Instagram
    • [ ] Resolve #44
    • [x] Resolve #49
    • [x] ~Use RxSocialLogin without RxJava~ -> In 1.5.0
    • [x] Refactor code using Codacy

    Edit in 2019-02-12

    • Paypal: I can't find any information for acquiring access_token without button. So, I can't implement this feature.
    • Use RxSocialLogin without RxJava: Need some time to think about api design. this feature can occur some big changes, so leave that in now.
    enhancement 
    opened by WindSekirun 0
  • Error in Fragment: “Already managing a GoogleApiClient with id 0”

    Error in Fragment: “Already managing a GoogleApiClient with id 0”

    Your library crashes when it the functionality is placed in a fragment. the solution is in this link below. you will need to override the onPause

    https://stackoverflow.com/questions/36105118/error-in-fragment-already-managing-a-googleapiclient-with-id-0

    bug 
    opened by dogeri28 7
Releases(1.2.6-androidx)
Owner
WindSekirun (wind.seo)
Android Developer, Kotlin Lover.
WindSekirun (wind.seo)
Firebase with MVVM is a series of videos in which you will learn how to implement firebase with MVVM along with UI designs, GitHub branches, merging, and resolving conflicts.

In this project we will learn about Firebase Implementation with MVVM Architecture. It is a basic level Course and will go with project based approach so can understand better that how the things are working.

Shahzad Afridi 29 Jan 1, 2023
A Kotlin Multiplatform Project using TMDB Api. Currently supports Android,iOS,Desktop and web platforms

A Kotlin Multiplatform Project using TMDB Api(https://www.themoviedb.org/). Currently this project is implemented in following platforms Andr

Jackson E J 11 Nov 10, 2022
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Cossack Labs 1.6k Jan 8, 2023
⚙️ Extended gameplay mechanics and brand-new code foundations for Minecraft: Java Edition platforms

⚙️ foundation Extended gameplay mechanics and brand-new code foundations for Minecraft: Java Edition platforms. ?? Getting Started You can find inform

Hexalite Network 2 Aug 30, 2022
Repository of a multi-platform application running the same Compose source code on all platforms

Compose multiplatform demo demo.mov Using the same compose user interface (UI) from android on all principal platforms ?? ?? App Features This is a si

David Coronel 18 Dec 16, 2022
Extension functions over Android's callback-based APIs which allows writing them in a sequential way within coroutines or observe multiple callbacks through kotlin flow.

callback-ktx A lightweight Android library that wraps Android's callback-based APIs into suspending extension functions which allow writing them in a

Sagar Viradiya 171 Oct 31, 2022
Elixir is a library designed to make minecraft login easier.

Elixir Elixir is a library designed to make minecraft login easier. Usage We have a maven repo for this project. repositories { maven { url = "htt

null 4 Aug 11, 2022
Reusable login template to learn Kotlin & Android additional features

LogIn_Application reusable login template I started this project to learn Kotlin & Android additional features. This is LogIn Template App as part of

null 0 Dec 14, 2021
ATH Sample is a sample Authentication and Authorization Application with Kotlin Language and MVVM architecture.

ATH Sample ATH Sample is a sample Authentication and Authorization Application with Kotlin Language and MVVM architecture. Overview ATH Sample is a sa

AbolfaZl RezaEi 4 Jun 8, 2021
Login on Android with FirebaseUI

Implementing Login on Android with FirebaseUI This is part of Android Kotlin developer Course which implements Login on android with Fire BaseUI. Lice

Ramya Muthusamy 0 Dec 15, 2021
One-stop-shop for Social Network integrations

Roguin One stop shop for Social Network integrations Use the same code for Google, Facebook and Twitter What is Roguin Social Network integrations can

Fanis Veizis 17 Aug 22, 2022
Bego Chat is chat application in Kotlin and Firebase with the following features: last seen , user status like typing ,online and last seen with MVVM pattern and clean architecture

Compose ChatApp(Bego Chat) Bego Chat is Compose chat application in Kotlin and Firebase with the following features: sending all file types and abilit

Ahmed EL Bagory 5 Dec 20, 2022
Android app using Kotlin to manage to-do notes with firebase as backend service

TO-DO Manager TO-DO Manager is a simple note management app. Unlike other apps, TO-DO Manager is free and open source. You can access your nots from a

Ahmed Badr 3 Dec 10, 2022
Crunch-Mobile - A Food Delivery Mobile App which uses Modern App Architecture Pattern, Firebase And a Simple Restful Api

Crunch-Mobile This is a Food Delivery Mobile App which uses Modern App Architect

Bright Ugwu 1 Jan 1, 2022
🔥🖼 Display images stored in Cloud Storage for Firebase using Coil

firecoil firecoil allows you to load images from Cloud Storage for Firebase in your Android app (through a StorageReference) , using the image loading

Rosário Pereira Fernandes 35 Oct 4, 2022
E-Commerce application with MVVM & Clean Arch - Hilt - Coroutines - Retrofit - Firebase - Room DB.

E-Commerce-App E-Commerce application with MVVM & Clean Arch - Hilt - Coroutines - Retrofit - Firebase - Room DB. API Link Project Features MVVM with

Caner Türe 37 Nov 30, 2022
This library provides common speech features for ASR including MFCCs and filterbank energies for Android and iOS.

Kotlin Speech Features Quick Links ?? Introduction This library is a complete port of python_speech_features in pure Kotlin available for Android and

Merlyn Mind 13 Oct 7, 2022
Provides Kotlin libs and some features for building Kotlin plugins

Kotlin Plugin Provides Kotlin libs and some features for building awesome Kotlin plugins. Can be used instead of CreeperFace's KotlinLib (don't use to

null 3 Dec 24, 2021
AbstractMvp 0.8 0.0 Kotlin is a library that provides abstract components for MVP architecture realization, with problems solutions that are exist in classic MVP.

MinSDK 14+ AbstractMvp AbstractMvp is a library that provides abstract components for MVP architecture realization, with problems solutions that are e

Robert 12 Apr 5, 2022