@openauth/instagram
TypeScript icon, indicating that this package has built-in type declarations

0.5.0-alpha.2 • Public • Published

Open Auth - Instagram

Downloads Version License Typescript dependencies Status

@openauth/instagram is an implementation of Instagram OAuth.

See Instagram Basic Display API Document.

Installation

npm i @openauth/instagram

Usage

import { InstagramOAuth } from '@openauth/instagram'

const oauth = new InstagramOAuth({
  clientId: 'client_id',
  clientSecret: 'client_secret',
  redirectUri: 'https://wani.kr/auth/instagram/callback',
  scope: [
    'user_profile',
    'user_media',
  ],
})

// 1. After getting auth request uri, connect.
const redirectUri = await oauth.getAuthRequestUri()

// 2. It redirects with the code, and replaces the access token with this code value.
const { accessToken } = await oauth.getAccessTokenResponse(code)

// 3. Get user profile.
await oauth.getAuthUser(accessToken)

// 4. Other API
await oauth.getClient(accessToken).get({
  path: 'me',
  query: {
    fields: [
      'id',
      'username',
      'account_type',
      'media_count',
    ].join(','),
  },
})

Package Sidebar

Install

npm i @openauth/instagram

Weekly Downloads

4

Version

0.5.0-alpha.2

License

MIT

Unpacked Size

30 kB

Total Files

28

Last publish

Collaborators

  • wan2land