Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

anthonyjgrove/react-instagram-login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Instagram Login

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

Install

npm install react-instagram-login

How to use

import React from 'react';
import ReactDOM from 'react-dom';
import InstagramLogin from 'react-instagram-login';

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

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

onSuccess callback

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 name value
error string
error_reason string
error_description string

Parameters

params value default value
clientId string REQUIRED
scope string basic
onSuccess function REQUIRED
onFailure function REQUIRED
buttonText string Login with Instagram
cssClass string -
tag string button
type string button
implicitAuth boolean false

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

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

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

Dev Server

npm run start

Run Tests

npm run test:watch

Production Bundle

npm run bundle
Checkout my other login: React Google Login
Checkout keppelen's: React Facebook Login

Follow me on Twitter: @anthonyjgrove