All Projects → WindSekirun → Rxsociallogin

WindSekirun / Rxsociallogin

Licence: apache-2.0
An Android Library that provides social login for 15 platforms within by RxJava2, Kotlin and Firebase Authentication.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Rxsociallogin

Androidbase
Android project template for Gradle Kotlin DSL + 100% Kotlin + Base module + Extensions = ❤️
Stars: ✭ 92 (-21.37%)
Mutual labels:  rxjava2
Powerpermission
Android Permission lib PowerPermission makes handling runtime permissions extremely easy.
Stars: ✭ 103 (-11.97%)
Mutual labels:  rxjava2
Laqul
A complete starter kit that allows you create amazing apps that look native thanks to the Quasar Framework. Powered by an API developed in Laravel Framework using the easy GraphQL queries language. And ready to use the Google Firebase features.
Stars: ✭ 110 (-5.98%)
Mutual labels:  social-login
Timer
This is a simple rxjava2/rxjava3/kotlin-flow timer
Stars: ✭ 93 (-20.51%)
Mutual labels:  rxjava2
Rxcache
A local reactive cache for Java and Android. Now, it supports heap memory、off-heap memory and disk cache.
Stars: ✭ 102 (-12.82%)
Mutual labels:  rxjava2
Android Kotlin Mvp Clean Architecture
Clean architecture blueprint using Kotlin and MVP pattern.
Stars: ✭ 105 (-10.26%)
Mutual labels:  rxjava2
Argus Android
Login/Registration Module for Android
Stars: ✭ 89 (-23.93%)
Mutual labels:  social-login
Passport Social Grant
Stars: ✭ 114 (-2.56%)
Mutual labels:  social-login
Kotlinmvpsamples
🚀(Kotlin 版 )快速搭建 Kotlin + MVP + RxJava + Retrofit + EventBus 的框架,方便快速开发新项目、减少开发成本。
Stars: ✭ 103 (-11.97%)
Mutual labels:  rxjava2
Marvel
Stars: ✭ 109 (-6.84%)
Mutual labels:  rxjava2
Rx2animations
Repository for android animations Rx2 wrapper
Stars: ✭ 95 (-18.8%)
Mutual labels:  rxjava2
Refactoring Android App Series Overview
Overview of wonderful series started by Oday and Rakesh for refactoring android application under youtube channel Dry Code.
Stars: ✭ 101 (-13.68%)
Mutual labels:  rxjava2
Redgram For Reddit
An Open-Sourced Android Reddit Client
Stars: ✭ 106 (-9.4%)
Mutual labels:  rxjava2
Rxlife
使用Jetpack、Kotlin实现的RxJava自动注销库,你值得拥有!
Stars: ✭ 92 (-21.37%)
Mutual labels:  rxjava2
Spring Webmvc Pac4j
Security library for Spring Web MVC: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 110 (-5.98%)
Mutual labels:  social-login
Pufferdb
🐡 An Android & JVM key-value storage powered by Protobuf and Coroutines
Stars: ✭ 91 (-22.22%)
Mutual labels:  rxjava2
Droidcon Nyc 2017 Puzzlers
RxJava and Kotlin Puzzlers! Follow our Engineering Blog for article with explanation
Stars: ✭ 105 (-10.26%)
Mutual labels:  rxjava2
Rxbus2
RxJava2 based bus with queuing (e.g. lifecycle based) support
Stars: ✭ 116 (-0.85%)
Mutual labels:  rxjava2
Featureadapter
FeatureAdapter (FA) is an Android Library providing an optimized way to display complex screens on Android.
Stars: ✭ 112 (-4.27%)
Mutual labels:  rxjava2
Rxapp
Stars: ✭ 108 (-7.69%)
Mutual labels:  rxjava2

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 inheritIllegalStateException 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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].