Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

LinkedIn

Improve this doc

A Cordova plugin that lets you use LinkedIn Native SDKs for Android and iOS.

Please see the plugin's repo for detailed installation steps.

Repo: https://github.com/zyra/cordova-plugin-linkedin

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID
    $ npm install --save @ionic-native/linkedin@4
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { LinkedIn } from '@ionic-native/linkedin';

constructor(private linkedin: LinkedIn) { }

...

// check if there is an active session
this.linkedin.hasActiveSession().then((active) => console.log('has active session?', active));

// login
const scopes = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
this.linkedin.login(scopes, true)
  .then(() => console.log('Logged in!'))
  .catch(e => console.log('Error logging in', e));


// get connections
this.linkedin.getRequest('people/~')
  .then(res => console.log(res))
  .catch(e => console.log(e));

// share something on profile
const body = {
  comment: 'Hello world!',
  visibility: {
    code: 'anyone'
  }
};

this.linkedin.postRequest('~/shares', body)
  .then(res => console.log(res))
  .catch(e => console.log(e));

Instance Members

login(scopes, promptToInstall)

Login with the LinkedIn App

Param Type Details
scopes string[]

Scopes to authorize

promptToInstall boolean

set to true to prompt the user to download the LinkedIn app if it's not installed

Returns: Promise<any>

logout()

Clears the current session

getRequest(path)

Make a get request

Param Type Details
path string

request path

Returns: Promise<any>

postRequest(path, body)

Make a post request

Param Type Details
path string

request path

body Object

request body

Returns: Promise<any>

openProfile(memberId)

Opens a member’s profile

Param Type Details
memberId string

Member id

Returns: Promise<any>

hasActiveSession()

Checks if there is already an existing active session. This should be used to avoid unnecessary login.

Returns: Promise<boolean> returns a promise that resolves with a boolean that indicates whether there is an active session

getActiveSession()

Checks if there is an active session and returns the access token if it exists.

Returns: Promise<any> returns a promise that resolves with an object that contains an access token if there is an active session

API

Native

General