Logging In with InstaLib

/ Published in: jQuery
Save to your folder(s)

Logging In with InstaLib

Copy this code and paste it in your HTML
  1. //Create New Instance of the class. Pass your ClientID, Callback URL and location of PHP Proxy Script ( Included with Library )
  2. var instagram = new Instagram("45a0c872bc884a848ea73e12c9bd33b7", "your website", "instalib.php");
  4. // Check to see if the user has logged in before by checking Local Storage Cache. If they havent, send them to authorize you're application. If so, retrieve the userToken and begin
  5. if( instagram.getCachedToken() === false ){
  6. instagram.getToken();
  7. console.log("New Token: " + instagram.accessToken);
  8. }
  9. console.log("Cached Token if not New: " + instagram.accessToken);
  11. //Login Button
  12. $("button.authorize_button").on( "click", function(){
  13. console.log("CLICKED");
  14. // Send user to Instagram to authorize your application. Optional Permissions can be sent as an array.
  15. instagram.authorize(["likes","comments","relationships"]);
  16. });

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.