EasyAuth

An implementation of Authentication with Google and Facebook made easy

License

License

Categories

Categories

Net
GroupId

GroupId

net.devslash
ArtifactId

ArtifactId

easyauth
Last Version

Last Version

1.1.2
Release Date

Release Date

Type

Type

aar
Description

Description

EasyAuth
An implementation of Authentication with Google and Facebook made easy
Project URL

Project URL

https://github.com/paulthom12345/easy-auth
Source Code Management

Source Code Management

https://github.com/paulthom12345/easy-auth

Download easyauth

How to add to project

<!-- https://jarcasting.com/artifacts/net.devslash/easyauth/ -->
<dependency>
    <groupId>net.devslash</groupId>
    <artifactId>easyauth</artifactId>
    <version>1.1.2</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/net.devslash/easyauth/
implementation 'net.devslash:easyauth:1.1.2'
// https://jarcasting.com/artifacts/net.devslash/easyauth/
implementation ("net.devslash:easyauth:1.1.2")
'net.devslash:easyauth:aar:1.1.2'
<dependency org="net.devslash" name="easyauth" rev="1.1.2">
  <artifact name="easyauth" type="aar" />
</dependency>
@Grapes(
@Grab(group='net.devslash', module='easyauth', version='1.1.2')
)
libraryDependencies += "net.devslash" % "easyauth" % "1.1.2"
[net.devslash/easyauth "1.1.2"]

Dependencies

compile (4)

Group / Artifact Type Version
com.facebook.android : facebook-android-sdk jar 3.20.0
com.android.support » appcompat-v7 jar 21.0.3
com.squareup.picasso : picasso jar 2.5.0
com.google.android.gms » play-services jar 6.5.87

Project Modules

There are no modules declared in this project.

EasyAuth

Easy auth provides a way to have Google and Facebook login without much set up at all!

Installation

Easy auth can be installed using a gradle dependency

dependencies {
    compile 'net.devslash:easy-auth:1.0.+'
}

Useage

EasyAuth takes most of the pain away from doing user authentication through Facebook/Google. It's still a fairly new tool and as such will still see active development.

Logging in

To log in you'll need to create an activity (see the same app) that contains the Google Plus login button as well as the Facebook sign in button. Follow the guides found at Google and Facebook for how to set up your app for each of them. Once you've set up your signing configuration and Application Id's you'll be able to use easy auth.

If you ever need to grab authentication you'll use

    private AuthenticationProvider authenticationProvider;

The authentication provider provides an abstracted way for logging in with either Google or Facebook.

You will need to pass through lifecycle methods from your activity. These include

  • onCreate(Bundle)
  • onDestroy
  • onPause
  • onResume
  • onSaveInstanceState
  • onStop

As far as getting someone logged in with Facebook, if the button exists then your login will be done automatically. In any future activities Easy Auth will auto-login and allow you to access the users profile. For Google+ you'll need to hook the onClick method of the SignInButton to call 'authenticationProvider.doLogin(AvailableLogin.GOOGLE)'.

Using Easy auth to get the profile

Once you've logged in easy auth will provide the profiles to you as a callback. This callback interface is required as one of the constructors. The ability to register extra callbacks will come in an upcoming version.

The profile will be returned to you as an instance of ProfileProvider. All of the details will be available as a getter.

EasyAuth does currently not allow you to grab extra details apart from what is available in the ProfileProvider. You may either fork the project or wait for updates that allow you to dynamically request details.

Note for Facebook.

To work with EasyAuth you must initialise the login button with the following code:

LoginButton loginButton = (LoginButton) findViewById(R.id.authButton);
loginButton.setReadPermissions(Arrays.asList("email"));

Versions

Version
1.1.2
1.1.1
1.1
1.0.1