Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

omniauth-instagram-api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

omniauth-instagram-api

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Omniauth::InstagramAPI

Gem Version Build Status License

An OmniAuth strategy for authenticating with the Instagram API with Instagram Login via OAuth.

Note: Instagram API with Instagram Login is different from the Instagram Login with Facebook Login

Installation

Add this line to your application's Gemfile:

gem 'omniauth-instagram-api'

And then execute:

bundle install

Usage

Here's an example of using it in a Rails application:

# config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :instagram, ENV['INSTAGRAM_CLIENT_ID'], ENV['INSTAGRAM_CLIENT_SECRET']
end

Make sure to set INSTAGRAM_CLIENT_ID and INSTAGRAM_CLIENT_SECRET environment variables to your actual credentials or use Rails encrypted credentials (e.g. Rails.application.credentials.instagram).

Scopes

The default scope for this strategy is instagram_business_basic. To add more scopes simply specify them after your credentials:

# config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :instagram, ENV['INSTAGRAM_CLIENT_ID'], ENV['INSTAGRAM_CLIENT_SECRET'],
    scope: [
        'instagram_business_basic',
        'instagram_business_content_publish',
        'instagram_business_manage_messages',
        'instagram_business_manage_comments',
    ].join(",")
end

Auth Hash

This is an example of what the Auth Hash available in request.env['omniauth.auth'] would look like:

{
  provider: 'instagram',
  uid: '1234567890',
  info: {
    name: "John Doe",
    nickname: "johndoe",
    image: "https://scontent-nrt1-1.cdninstagram.com/v/..."
  },
  credentials: {
    token: 'qwertyuiopasdfghjklzxcvbnm',
    expires: true,
    expires_at: 1733140352,
  },
  extra: {
    raw_info: {
      id: "987654321",
      name: "John Doe",
      user_id: "1234567890",
      username: "johndoe",
      media_count: 1,
      account_type: "BUSINESS",
      follows_count: 42,
      followers_count: 42,
      profile_picture_url: "https://scontent-nrt1-1.cdninstagram.com/v/..."
    }
  }
}

The token stored in the credentials lasts for 60 days and can be refreshed.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 08 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc