Giter Site home page Giter Site logo

nglinkedin's Introduction

ngLinkedIn

LinkedIn wrapper for AngularJS.

See official LinkedIn API for more info and options.

Usage

Install via bower:

bower install ngLinkedIn --save

Include ngLinkedIn module:

angular.module('app', ['ngLinkedIn']);

Set app key through config provider:

.config(function($linkedInProvider) {
   $linkedInProvider.set('appKey', '123456789');
});

Use in controller:

.controller(['$scope', '$linkedIn', function($scope, $linkedIn) {
  $scope.connect = function() {
      $linkedIn.authorize();
  }
}]);

Additional options

The following options are supported through config:

Property Type Default
appKey String null
authorize Boolean false
lang String 'en_US'
scope String 'r_basicprofile'

You can also chain the config setting during setup like this:

$linkedInProvider
    .set('appKey', '123456789')
    .set('scope', 'r_basicprofile r_network')
    .set('authorize', true);

Common issues

Uncaught Error: You must specify a valid JavaScript API Domain as part of this key's configuration.

You need to set API Domains in your app. It is located in JavaScript API Domains: in the Other section in your app.

Available API methods

Most of the API functions are supported:

$linkedIn.isAuthorized()

IN.User.isAuthorized() - Checks if user is already authorized and returns true or false.

$linkedIn.authorize()

IN.User.authorize() - Opens auth popup for user authorization.

$linkedIn.refresh()

IN.User.refresh() - Extend token life by 30 minutes.

$linkedIn.logout()

IN.User.logout() - End user session.

$linkedIn.share(url)

IN.UI.Share() - Share specified URL.

$linkedIn.api(api, ids, field, params)

General api method that is used by shortcut methods:

  • $linkedIn.profile(ids, field, params) // get user(s) profile(s).
  • $linkedIn.connections(ids, field, params) // get connections. requires 'r_network' and 'rw_nus' permissions.
  • $linkedIn.memberUpdates(ids, field, params) // get updates. requires 'rw_nus' permission.

All 3 params (ids, field, params) are optional. If ids is not provided, 'me' is used by default to get info about current user.

For more information about fields and params refer to API Documentation.

nglinkedin's People

Contributors

aromka avatar jayzeng avatar

Watchers

 avatar James Cloos 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.