SimpleAuth


Source link: https://github.com/jaychang0917/SimpleAuth

SimpleAuth

A easy to use social authentication android library. (Facebook, Google, Twitter, Instagram)

Installation

In your project level build.gradle :

allprojects {

  repositories {

...

maven {
 url "https://jitpack.io" 
}

  
}
 
}

In your app level build.gradle :

dependencies {

  compile 'com.github.jaychang0917:SimpleAuth:{
latest_version
}
' 
}

Basic Usage

1. Configure the SimpleAuth

In your app level build.gradle, set up the configs. Leave the field empty if you don't need it, DON'T remove any fields.

android.defaultConfig.manifestPlaceholders = [

facebookAppId

  : "your facebook app id",

googleWebClientId
 : "your google web client id",

twitterConsumerKey
: "your twitter consumer key",

twitterConsumerSecret: "your twitter consumer secret",

instagramClientId
 : "your instagram client id",

instagramClientSecret: "your instagram client secret",

instagramRedirectUri : "your instagram redirect uri" ]

2. Connect it. Done!

void connectFacebook() {

List<String> scopes = Arrays.asList("user_birthday", "user_friends");

 SimpleAuth.getInstance().connectFacebook(scopes, new AuthCallback() {

  @Override
  public void onSuccess(SocialUser socialUser) {

 Log.d(TAG, "userId:" + socialUser.userId)

 Log.d(TAG, "email:" + socialUser.email)

 Log.d(TAG, "accessToken:" + socialUser.accessToken)

 Log.d(TAG, "profilePictureUrl:" + socialUser.profilePictureUrl)

 Log.d(TAG, "username:" + socialUser.username)

 Log.d(TAG, "fullName:" + socialUser.fullName);

 Log.d(TAG, "pageLink:" + socialUser.pageLink)
  
}

@Override
  public void onError(Throwable error) {

 Log.d(TAG, error.getMessage());

  
}

@Override
  public void onCancel() {

 Log.d(TAG, "Canceled");

  
}

}
);
 
}

Advanced Usage

Disconnection

The active session will be cleared if the social app is installed in the device, otherwise app cookies will be cleared (i.e. user need to login again)

void disconnectFacebook() {

SimpleAuth.getInstance().disconnectFacebook();
 
}

Revoke connected application

After revocation, the permissions authorization page should be shown again. Only facebook and google provide this function.

void revokeFacebook() {

SimpleAuth.getInstance().revokeFacebook();
 
}

Remark

Google auth

Please be reminded that to create an Android oauth client and fill in SHA1 of your release keystore for release build variant.

License

Copyright 2017 Jay Chang  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. 

Resources

TextChronometer is a very simple library offering a widget showing a live time formatted like "4 seconds ago": This library is very convenient if you are building apps with a live timeline.

A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds.

An animated path view following the methods in a blog post.

A highly configurable section based layout manager with headers and all that.

Features:

  • Section Headers
    • Sticky headers
    • Headers in content margins
    • Header overlays
  • Individual layouts for each section at the same time
    • Linear
    • Grid not yet implemented
    • Staggered Grid not yet implemented

A file picker fragment for Android that can be embedded in your app.

Android library project that intends to simplify the usage of location providers with a twist: you can modify the location strategy based in your activity.

The principle behind it is detecting the activity the user is doing (moving in a vehicle, riding a bicycle, walking, running, being still) and based on those results, changing the accuracy for the detection and the sensors used.

All this is aimed to be more battery efficient than the usual location strategies.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes