npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gcou/react-native-linkedin

v2.3.0

Published

React-Native LinkedIn, a simple LinkedIn login library for React-Native with WebView and Modal - compatibility with RN 0.73

Downloads

914

Readme

Benefits

  • 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

Installation

$ yarn add @gcou/react-native-linkedin

If your project uses expo >= 48, then you need to add expo-crypto to your project. The uuid library uses the Expo module if present. If Expo >= 48, then the crypto elements are in the expo-crypto module

$ yarn add expo-crypto

Security

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

  <LinkedInModal
    shouldGetAccessToken={false}
    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(`Post this ${authentication_code} to your server.`)}
  />

Example

// See ./App.tsx file for details
import React, {ReactElement, useRef} 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 function AppContainer() : ReactElement {
  linkedRef = useRef<any>();
  
  return (
    <View style={styles.container}>
      <LinkedInModal
        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)}
      />
      <Button title="Log Out" onPress={this.linkedRef.current.logoutAsync()} />
    </View>
  )
}

Props

| 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 | | onError | function | optional | console.error(err) | Function will be call back on error | | 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 | string[] | optional | 'r_liteprofile', 'r_emailaddress' | The LinkedIn access token permissions | | renderButton | ReactElement | optional | | Render for customize LinkedIn button | | renderClose | ReactElement | optional | | Render for customize close button | | linkText | string | optional | 'Login with LinkedIn' | Link label | | containerStyle | StyleProp | optional | | Customize container style | | wrapperStyle | StyleProp | optional | | Customize wrapper style | | closeStyle | StyleProp | optional | | Customize close style | | animationType | Modal.propTypes.animationType | optional | fade | Customize animationType style: 'none', 'slide' or 'fade' | | shouldGetAccessToken | bool | optional | true | Set to false to receive the 'authorization code' rather then the 'access token' | | areaTouchText | object | optional | {top: 20, bottom: 20, left: 50, right: 50} | Set values for to increase the text touch area |

Contribution

PRs are welcome!

FAQ

Is it supported and tested both on android and iOS?

YES

How to logout react-native-linkedin?

<View style={styles.container}>
    <LinkedInModal
      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)}
    />
    <Button title="Log Out" onPress={this.linkedRef.current.logoutAsync()} />
</View>

Other questions

Feel free to contact me or create an issue

Alternatives

Hire an expert!

Looking for a ReactNative freelance expert with more than 12 years of experience? Contact me from my website!

Licence

MIT

made with ♥