Giter VIP home page Giter VIP logo

linkedin-android-sdk's Introduction

Linkedin Android SDK (Unofficial)

LinkedinSDK allows you to get linkedin access token inside your Android application.

Installation

To install the SDK:

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency:

implementation 'com.github.ovidos:linkedin-android-sdk:0.1.9'

For login flow to work, LinkedinSignInActivity needs to be added to AndroidManifest.xml:

<activity android:name="com.omralcorut.linkedinsignin.ui.LinkedinSignInActivity"/>

Also, you need to add internet permission to AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />

Authentication

Linkedin SDK is allows you to authenticate with OAuth2 authentication. This means that, you are allowed to manage other people's account that are authorized with your application.

Getting Started

First of all you need to retrieve Client ID, Client Secret and Redirect Uri from Linkedin. To add Client ID, Client Secret and Redirect Uri into your application:

  1. Open your Application Class and add the following

// Kotlin

Linkedin.initialize(context = applicationContext,
        	clientId = "LINKEDIN_CLIENT_ID",
        	clientSecret = "LINKEDIN_CLIENT_SECRET",
        	redirectUri = "LINKEDIN_REDIRECT_URI",
        	state = "RANDOM_STRING",
        	scopes = listOf("r_liteprofile", "r_emailaddress"))

// Java

Linkedin.Companion.initialize(getApplicationContext(),
            	"LINKEDIN_CLIENT_ID",
            	"LINKEDIN_CLIENT_SECRET",
            	"LINKEDIN_REDIRECT_URI",
            	"RANDOM_STRING",
            	Arrays.asList("r_liteprofile", "r_emailaddress"));

"State" is a unique string of your choice designed to protect against CSRF attacks.

  1. To authorize a user for your application:

// Kotlin

Linkedin.login(this, object : LinkedinLoginViewResponseListener {
      	override fun linkedinDidLoggedIn(linkedinToken: LinkedinToken) {
          	// Success
      	}
      	override fun linkedinLoginDidFail(error: String) {
          	// Fail
      	}

})

// Java

Linkedin.Companion.login(this, new LinkedinLoginViewResponseListener() {
      	@Override
      	public void linkedinDidLoggedIn(@NotNull LinkedinToken linkedinToken) {
          	// Success
      	}

      	@Override
      	public void linkedinLoginDidFail(@NotNull String error) {
          	// Fail
      	}
});

linkedin-android-sdk's People

Contributors

omralcrt avatar ilyalitosh avatar

Stargazers

 avatar Shunan avatar Hossam Rakha avatar Narayan Panthi avatar  avatar  avatar Tuan Pham avatar Hasan Küçük avatar Oguz Dogan avatar Tahsin Kasap avatar

Watchers

James Cloos avatar Kemal Kocabiyik avatar Tahsin Kasap avatar  avatar

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.