Easy login with Google, Facebook, VK for android apps
fun loginWithGoogle() {
startActivityForResult(SocialLogin.loginIntent(this, LoginType.GOOGLE), 0)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
val loginResult: LoginResult? = data?.loginResult
// do something
} val withInfo = SocialLogin.getResultWithUserInfo(loginResult)
val avatar = withInfo.avatar
val email = withInfo.email
val firstName = withInfo.firstName
val lastName = withInfo.lastName // for VK
SocialLogin.loginIntent(this, LoginType.VK, VKScope.FRIENDS.name, VKScope.PHONE.name)
// for Facebook
SocialLogin.loginIntent(this, LoginType.FB, "user_friends")<resources>
<!--For Google (optional)-->
<string name="default_web_client_id">...</string>
<!--For Facebook (required)-->
<string name="facebook_app_id">...</string>
<string name="fb_login_protocol_scheme">...</string>
<!--For VK (required)-->
<integer name="com_vk_sdk_AppId">...</integer>
</resources>repositories {
maven { url "https://jitpack.io" }
}
dependencies {
// For all social networks
implementation 'com.github.kakadu-dev:android-sociallogin:1.2.13'
// also for Huawei
implementation 'com.huawei.hms:hwid:6.4.0.300'
// or exclude some
implementation('com.github.kakadu-dev:android-sociallogin:1.2.13') {
exclude group: 'com.vk' //without VK
exclude group: 'com.facebook.android' //without Facebook
exclude group: 'com.google.android.gms' //without Google
}
}