venits / instagram-web-oauth

Easiest way to get access token from Instagram.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Instagram Oauth2.0 for Web

The easiest way to create authentication flow with Instagram.

You can also check react-instagram-photo-picker which uses this module for authorization.

Requirements

First of all go to Instagram Developer Console and create your app.

After creating app go to: Manage Clients -> Manage -> Security.

Some important notes:

  1. Disable implicit OAuth - must be unchecked, otherwise we will not be able to use Implicit flow!

  2. Valid redirect URIs - add URI from where you are calling instagram authorization.

For example your redirect URI can look like this: http://localhost:3000/.

Demo

Usage

Usage is very simple it requires just 3 lines of code :)

  1. Put this line of code in </head> tag.
<head>
  <script src="https://instagram-web-auth.firebaseapp.com/instauth.min.js"></script>
    ...
</head>
  1. Put this line of code in </body> tag.
<script>
  window.InstAuth.init(your_client_id_from_instagram_console);
</script>
  1. Call startAuthFlow() everywhere user clicks 'Log in to Instagram'
  window.InstAuth.startAuthFlow();

After successful authorization in console you should notice this message:

Instagram access_token: 707...46b4

And that's all :)

You can get your access_token any time using this line of code:

var token = window.InstAuth.getAccessToken();

Summary

I hope that you will find this module useful and also if you have any problems or questions please let me know I will be more than happy to help you :)

My email: tomasz.przybyl.it@gmail.com

About

Easiest way to get access token from Instagram.

License:MIT License


Languages

Language:JavaScript 100.0%