Giter VIP home page Giter VIP logo

socialauth's Introduction

SocialAuth

A library that helps to implement social network authorization (Facebook, Twitter, Instagram, GooglePlus, VK).

###Twitter Create new application at https://apps.twitter.com

Download via Gradle:

compile 'com.github.pavel163.SocialAuth:twitter:1.0.4'

In strings.xml

<string name="twitter_consumer_key">your_consumer_key</string>
<string name="twitter_consumer_secret">your_consumer_secret</string>

If you don't use fabric plugin for Android studio, put it into gradle:

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

And look at an example (May be a fragment instead of activity) TwitterActivity

###Facebook Create new application at https://developers.facebook.com/apps
Download via Gradle:

compile 'com.github.pavel163.SocialAuth:facebook:1.0.4'

In strings.xml

<string name="facebook_app_id">your_app_id</string>

Add the Maven Central Repository to build.gradle before dependencies:

repositories {
   mavenCentral()
}

Add a meta-data element to the application element:

<application android:label="@string/app_name" ...>
    ...
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
    ...
</application>

And look at an example (May be a fragment instead of activity) FacebookActivity

###VK Create new application at https://vk.com/dev
Download via Gradle:

compile 'com.github.pavel163.SocialAuth:vk:1.0.4'

In integers.xml

<integer name="com_vk_sdk_AppId">your_app_id</integer>

Create Custom Application:

public class BaseApplication extends VkApplication {
    
    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Override
    protected void tokenIsInvalid() {
        // invalid token
    }
}

And look at an example (May be a fragment instead of activity) VkActivity

###Instagram Create new application at https://www.instagram.com/developer/clients/manage/
Don't forget to enable implicit OAuth in application security settings.

Download via Gradle:

compile 'com.github.pavel163.SocialAuth:instagram:1.0.4'

In strings.xml

<string name="instagram_redirect_uri">your_redirect_uri</string>
<string name="instagram_app_id">your_app_id</string>

And look at an example (May be a fragment instead of activity) InstagramActivity

###Google+ Create new application at https://console.developers.google.com/
Don't forget to enable google plus api.

Download via Gradle:

compile 'com.github.pavel163.SocialAuth:google:1.0.4'

In strings.xml

<string name="google_app_id">your_app_id</string>

And look at an example (May be a fragment instead of activity) GooglePlusActivity

socialauth's People

Contributors

pavel163 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

socialauth's Issues

Hardcored Facebook Permissions

Can you make permissions of facebook modifiable?
now we have
this.facebookPermissions = Arrays.asList(new String[]{"public_profile", "email", "user_birthday", "user_friends"});

need somithing like this
facebookClient.setRequestedPermission(new String[] or ArrayList)

Already managing a GoogleApiClient with id 0

Hello. Crash with java.lang.IllegalStateException: Already managing a GoogleApiClient with id 0,
after try to integrate your lib to my project. Everything is done as on this activity https://github.com/pavel163/SocialAuth/blob/master/app/src/main/java/com/ebr163/socialauth/GooglePlusActivity.java, Stackoverflow recommend use this code http://stackoverflow.com/questions/36105118/already-managing-a-googleapiclient-with-id-0-in-fragment , i look at your source code, you have such method, named "free" but it's unused method.

Constructors call twice

If we will use this code in fragment
googlePlusClient = new GooglePlusClient(this);

will call public GooglePlusClient(Fragment fragment) {
and after this will be call public GooglePlusClient(Activity activity) {
as conclusion init method will call twice and will be crashed with

java.lang.IllegalStateException: Already managing a GoogleApiClient with id 0


we can fix this crash if change googlePlusClient = new GooglePlusClient(this); to googlePlusClient = new GooglePlusClient(getActivity); (only activity constructor will be call) , but method onActivityResult call in activity class, not in fragment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.