React-Native LinkedIn, a simple LinkedIn login library for React-Native with WebView and Modal
npm install @smuxx/react-native-linkedin
![]()
Simple LinkedIn login library for React-Native with WebView into a Modal
- Light: No need to link a native library like others alternatives
- Simple: Get the token and the expires, you handle your own login with the access_token
- Sure: open-source
- Almost readable & understandable code: JavaScript & React
``bash`
$ yarn add react-native-linkedin
Please note that you should give your linkedin client id but not your secret key to this component.
You should be aware that key can be found if you store it directly to your code.
I strongly recommend to not declare client secret key on your code but found a way to keep it secret
- > Related issue
- > LinkedIn Documentation
`tsxPost this ${authentication_code} to your server.
clientSecret={null}
clientID="[ Your client id from https://www.linkedin.com/developer/apps ]"
redirectUri="[ Your redirect uri set into https://www.linkedin.com/developer/apps ]"
onSuccess={{ authentication_code } => console.log()}`
/>
`JavaScript
// See ./App.tsx file for details
import React from 'react'
import { StyleSheet, View } from 'react-native'
import LinkedInModal from 'react-native-linkedin'
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
justifyContent: 'center',
alignItems: 'center',
},
})
export default class AppContainer extends React.Component {
linkedRef = React.createRef
render() {
return (
clientID="[ Your client id from https://www.linkedin.com/developer/apps ]"
clientSecret="[ Your client secret from https://www.linkedin.com/developer/apps ]"
redirectUri="[ Your redirect uri set into https://www.linkedin.com/developer/apps ]"
onSuccess={token => console.log(token)}
/>
)
}
}
`
| Name | Type | Required | Default | Description |
| ------------------------ | ----------------------------- | ------------------------------------------------------------------------------------- | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| clientID | string | required | | Your client id |
| clientSecret | string | use shouldGetAccessToken={false} and read authorization_code onSuccess return | | Should not be stored in app WARNING! Your client secret |
| redirectUri | string | required | | Your redirectUri |
| onSuccess | function | required | | Function will be call back on success |
| authState | string | optional | require('uuid').v4() | The state of auth, to be more secure |console.error(err)
| onError | function | optional | | Function will be call back on error |'r_liteprofile', 'r_emailaddress'
| onClose | function | optional | | Function will be call back on close modal |
| onOpen | function | optional | | Function will be call back on open modal |
| onSignIn | function | optional | | Function will be call back when the user sign in |
| permissions | array | optional | | The LinkedIn access token permissions |'Login with LinkedIn'
| renderButton | function | optional | | Render function for customize LinkedIn button |
| renderClose | function | optional | | Render function for customize close button |
| linkText | string | optional | | Link label |fade
| containerStyle | ViewPropTypes.style | optional | | Customize container style |
| wrapperStyle | ViewPropTypes.style | optional | | Customize wrapper style |
| closeStyle | ViewPropTypes.style | optional | | Customize close style |
| animationType | Modal.propTypes.animationType | optional | | Customize animationType style: 'none', 'slide' or 'fade' |true
| shouldGetAccessToken | bool | optional | | Set to false to receive the 'authorization code' rather then the 'access token' |{top: 20, bottom: 20, left: 50, right: 50}
| areaTouchText | object | optional | | Set values for to increase the text touch area |
- @xcarpentier The main author.
PRs are welcome!
YES
tsx
ref={this.linkedRef}
clientID="[ Your client id from https://www.linkedin.com/developer/apps ]"
clientSecret="[ Your client secret from https://www.linkedin.com/developer/apps ]"
redirectUri="[ Your redirect uri set into https://www.linkedin.com/developer/apps ]"
onSuccess={token => console.log(token)}
/>
``Feel free to contact me or create an issue
- react-native-linkedin-login
- react-native-linkedin-sdk
- react-native-linkedin-oauth
Looking for a ReactNative freelance expert with more than 12 years of experience? Contact me from my website!
> made with ♥