-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ea70de1
Showing
83 changed files
with
4,312 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Android template | ||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/gradle.xml | ||
.idea/assetWizardSettings.xml | ||
.idea/dictionaries | ||
.idea/libraries | ||
.idea/caches | ||
|
||
# Keystore files | ||
# Uncomment the following line if you do not want to check your keystore files in. | ||
#*.jks | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
google-services.json | ||
|
||
# Freeline | ||
freeline.py | ||
freeline/ | ||
freeline_project_description.json | ||
|
||
# fastlane | ||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
fastlane/test_output | ||
fastlane/readme.md | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## Change Log | ||
|
||
### Version 2.1.4 (2018-11-13) | ||
- Fix [#23](https://github.com/jaychang0917/SimpleAuth/issues/23) | ||
|
||
### Version 2.1.3 (2018-07-08) | ||
- Fix [#20](https://github.com/jaychang0917/SimpleAuth/issues/20) | ||
|
||
### Version 2.1.2 (2018-06-28) | ||
- Fix [#19](https://github.com/jaychang0917/SimpleAuth/issues/19) | ||
|
||
### Version 2.1.1 (2018-05-30) | ||
- Fix [#12](https://github.com/jaychang0917/SimpleAuth/issues/12) and [#17](https://github.com/jaychang0917/SimpleAuth/issues/17) | ||
|
||
### Version 2.1.0 (2018-05-25) | ||
- Be java backward compatible | ||
|
||
### Version 2.0.3 (2018-05-25) | ||
- Fix compile issue | ||
|
||
### Version 2.0.1 (2018-03-09) | ||
- Fix [#7](https://github.com/jaychang0917/SimpleAuth/issues/7) | ||
|
||
### Version 1.0.5 (2017-11-01) | ||
- Fix wrong meta-value genertation in Android Studio 3.0 issue [PR#2](https://github.com/jaychang0917/SimpleAuth/pull/2) | ||
|
||
### Version 1.0.4 (2017-07-25) | ||
- Fix twitter disconnection issue | ||
|
||
### Version 1.0.3 (2017-07-19) | ||
- Fix facebook connect error when switch to another account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# SimpleAuth | ||
[![Download](https://api.bintray.com/packages/jaychang0917/maven/simpleauth/images/download.svg) ](https://bintray.com/jaychang0917/maven/simpleauth/_latestVersion) | ||
|
||
A easy to use social authentication android library. (Facebook, Google, Twitter, Instagram) | ||
|
||
## Installation | ||
In your app level build.gradle : | ||
|
||
```java | ||
dependencies { | ||
compile 'com.jaychang:simpleauth:2.1.4' | ||
// if you want to use facebook auth | ||
compile 'com.jaychang:simpleauth-facebook:2.1.4' | ||
// if you want to use google auth | ||
compile 'com.jaychang:simpleauth-google:2.1.4' | ||
// if you want to use instagram auth | ||
compile 'com.jaychang:simpleauth-instagram:2.1.4' | ||
// if you want to use twitter auth | ||
compile 'com.jaychang:simpleauth-twitter:2.1.4' | ||
} | ||
``` | ||
|
||
|
||
## Basic Usage | ||
#### 1. Configure the SimpleAuth | ||
In your app level build.gradle, set up the configs. | ||
|
||
```xml | ||
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", | ||
instagramRedirectUrl : "your instagram redirect url" | ||
] | ||
``` | ||
|
||
#### 2. Connect it. Done! | ||
```java | ||
void connectFacebook() { | ||
List<String> scopes = Arrays.asList("user_birthday", "user_friends"); | ||
|
||
SimpleAuth.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"); | ||
} | ||
}); | ||
} | ||
``` | ||
### Remark | ||
#### Google auth | ||
Please be reminded to create an **Android** oauth client and fill in **SHA1** of your keystore and **package name** | ||
|
||
#### Twitter auth | ||
Please be reminded to fill in the **Callback URLs** (e.g. `twittersdk://`) of your twitter app. | ||
|
||
## 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) | ||
```java | ||
void disconnectFacebook() { | ||
SimpleAuth.disconnectFacebook(); | ||
} | ||
``` | ||
|
||
#### Revoke connected application | ||
After revocation, the permissions authorization page should be shown again. Only facebook and google provide this function. | ||
```java | ||
void revokeFacebook() { | ||
SimpleAuth.revokeFacebook(); | ||
} | ||
``` | ||
|
||
## 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. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Android template | ||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/gradle.xml | ||
.idea/assetWizardSettings.xml | ||
.idea/dictionaries | ||
.idea/libraries | ||
.idea/caches | ||
|
||
# Keystore files | ||
# Uncomment the following line if you do not want to check your keystore files in. | ||
#*.jks | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
google-services.json | ||
|
||
# Freeline | ||
freeline.py | ||
freeline/ | ||
freeline_project_description.json | ||
|
||
# fastlane | ||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
fastlane/test_output | ||
fastlane/readme.md | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'kotlin-android' | ||
apply plugin: 'kotlin-android-extensions' | ||
apply plugin: 'kotlin-kapt' | ||
|
||
def appVersionCode = 1 | ||
def appVersionName = "1.0.0" | ||
|
||
android { | ||
compileSdkVersion 30 | ||
buildToolsVersion "30.0.0" | ||
defaultConfig { | ||
applicationId "com.jaychang.demo.sa" | ||
minSdkVersion rootProject.minSdkVersion | ||
targetSdkVersion rootProject.targetSdkVersion | ||
versionCode appVersionCode | ||
versionName appVersionName | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
lintOptions { | ||
abortOnError false | ||
} | ||
} | ||
|
||
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", | ||
instagramRedirectUrl : "your instagram redirect url" | ||
] | ||
|
||
dependencies { | ||
implementation "androidx.appcompat:appcompat:1.3.0-alpha02" | ||
implementation 'com.jakewharton:butterknife:10.2.3' | ||
kapt 'com.jakewharton:butterknife-compiler:10.2.3' | ||
implementation project(':library-common') | ||
implementation project(':library-facebook') | ||
implementation project(':library-google') | ||
implementation project(':library-instagram') | ||
implementation project(':library-twitter') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Users/jaychang/Library/Android/sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<manifest package="com.jaychang.demo.sa" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
|
||
<activity android:name="com.jaychang.demo.sa.MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<activity android:name="com.jaychang.demo.sa.ProfileActivity" /> | ||
|
||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.