1.0.14 • Published 7 years ago

react-linkedin-sdk-hot-fix v1.0.14

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

React Linkedin SDK

A React Component for Linkedin SDK

Getting Started

yarn add react-linkedin-sdk
or
npm install react-linkedin-sdk --save

How to use

Basic

import React from 'react'
import ReactDOM from 'react-dom'
import LinkedinSDK from 'react-linkedin-sdk'

const responseLinkedin = response => {
  console.log(response)
}

ReactDOM.render(
  <LinkedinSDK
    clientId="123456789010"
    callBack={responseLinkedin}
    fields=":(id,num-connections,picture-url)"
    className={'className'}
    loginButtonText={'Login with Linkedin'}
    logoutButtonText={'Logout from Linkedin'}
    buttonType={'button'}
    icon={<Icon />}
    getOAuthToken
  />,
  document.getElementById('demo')
)

Custom permission

By default the component, request only 'public_profile' permission, you can add more permissions on your app.

see https://developer.linkedin.com/docs/fields for permissions list

import React from 'react'
import LinkedinSDK from 'react-linkedin-sdk'

class MyComponent extends React.Component {
  responseLinkedin(response) {
    console.log(response)
  }

  render() {
    return (
      <LinkedinSDK
        clientId="123456789010"
        callBack={responseLinkedin}
        fields=":(id,num-connections,picture-urls::(original))"
        className={'className'}
        loginButtonText={'Login with Linkedin'}
        logoutButtonText={'Logout from Linkedin'}
        buttonType={'button'}
        icon={<Icon />}
        getOAuthToken
      />
    )
  }
}

export default MyComponent

Parameters

paramsvaluedefault value
clientIdstringRequired
fieldsstringRequired
callbackfunctionRequired
classNamestringnone
loginButtonTextstringLogin with Linkedin
logoutButtonTextstringLogout from Linkedin
buttonTypestringbutton
iconstringnone
getOAuthTokenboolfalse