4.0.0 • Published 8 months ago

@amraneze/react-instagram-login v4.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

npm version npm npm bundle size npm bundle size GitHub release (release name instead of tag name) build

React Instagram Login

An Instagram oAUth Sign-in / Log-in Component for React

Install

npm install @amraneze/react-instagram-login
yarn add @amraneze/react-instagram-login

How to use

With default button

import ReactDOM from 'react-dom';
import { InstagramLogin } from '@amraneze/react-instagram-login';

const responseInstagram = (response) => {
  console.log(response);
};

ReactDOM.render(
  <InstagramLogin
    clientId="CLIENT_ID"
    buttonText="Login"
    onSuccess={responseInstagram}
    onFailure={responseInstagram}
  />,
  document.getElementById("instagramButton")
);

Note: Here is a sandbox to play around.

onSuccess callback

Displaying OAuth using a popup

Note: The redirectUri needs to be the same url as the current url.

Displaying OAuth using a redirection

If you want to use redirection you should change the prop useRedirect to true. Callback will return a code for use on your server to get a full access_token. If implicitAuth is set to true it will return the full access_token directly.

onFailure callback

Callback will return an error object.

property namevalue
errorstring
error_reasonstring
error_descriptionstring

Parameters

paramsvaluedefault value
clientIdstringREQUIRED
scopestringuser_profile
onSuccessfunctionREQUIRED
onFailurefunctionREQUIRED
redirectUristring-
buttonTextstringLogin with Instagram
cssClassstring-
tagstringbutton
typestringbutton
implicitAuthbooleanfalse
useRedirectbooleanfalse
widthnumber400
heightnumber800

Instagram API Docs: https://www.instagram.com/developer/

You can now also pass child components such as icons into the button component.

<InstagramLogin
  clientId="CLIENT_ID"
  onSuccess={responseInstagram}
  onFailure={responseInstagram}
>
  <FontAwesome name="instagram" />
  <span> Login with Instagram</span>
</InstagramLogin>

Dev Server

yarn dev

Run Tests

yarn test

Production Bundle

yarn build

TODO

  • Fix the test cases
  • Add templates for PR and Issues
  • Use Google, Facebook, Linkedin ... in this project

Done

  • Use Hooks
  • Update dependencies
  • Create a babel Conf
  • Use prettier + Husky
  • Improve and refactor the code

Follow me on Twitter: @Amraneze

4.0.0

8 months ago

3.0.5

10 months ago

3.0.4

10 months ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.1

3 years ago

2.0.0

3 years ago