Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.JailbirdInteractive:Login:0.3.1'
}
dependencies {
implementation("com.github.JailbirdInteractive:Login:0.3.1")
}
<dependency>
<groupId>com.github.JailbirdInteractive</groupId>
<artifactId>Login</artifactId>
<version>0.3.1</version>
</dependency>
libraryDependencies += "com.github.JailbirdInteractive" % "Login" % "0.3.1"
:dependencies [[com.github.JailbirdInteractive/Login "0.3.1"]]
Very simple implementaion for social login on android
In build.gradle
root level add that:
buildscript {
repositories {
jcenter()
}
dependencies {
...
classpath 'com.google.gms:google-services:3.0.0'
...
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
In build.gradle
app level add that:
apply plugin: 'com.google.gms.google-services'
...
dependencies {
...
compile 'com.github.RogaLabs:social-login:[latest-version]'
...
}
Register an app on Google Developers console
after that, you should ensure which the file google-services.json is inside app
module
Create an app on Facebook Developers
after
add in your string.xml
:
<string name="facebook_app_id">1320760547953881</string>
and
<application android:label="@string/app_name" ...>
...
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
...
</application>
Init the Social Login on your application:
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
LoginApplication.startSocialLogin(this);
}
}
In your Login Activity you should extends one specific class
:
public class YourLoginActivity extends LoginView
Login with google:
loginWithGoogle(new Callback() {
@Override
public void onSuccess(SocialUser socialUser) {
buildProfileDialog(socialUser);
}
@Override
public void onError(Throwable throwable) {
throwable.printStackTrace();
}
});
Login with Facebook:
loginWithFacebook(new Callback() {
@Override
public void onSuccess(SocialUser socialUser) {
buildProfileDialog(socialUser);
}
@Override
public void onError(Throwable throwable) {
throwable.printStackTrace();
}
});