Glowb Dev Docs
SaaS APIInstagram OAuth

Instagram OAuth API

Instagram Business 계정 연동 API (Facebook Graph API 기반)

Instagram OAuth API

Instagram Business 계정을 연동하기 위한 OAuth API입니다. Facebook Graph API를 통해 Instagram Business Account에 접근합니다.

Base URL: /ai/instagram

인증 정보

항목
인증 필요일부 필요
인증 방식JWT Bearer Token

OAuth 연동 플로우

Instagram 연동은 프론트엔드 Callback 방식을 사용합니다.

1. OAuth URL 요청

프론트엔드에서 백엔드 API를 호출하여 Facebook OAuth URL을 받습니다.

GET /ai/instagram/oauth/url?memberId=user123

응답:

{
  "status": 200,
  "message": "OAuth URL 생성 완료",
  "data": "https://www.facebook.com/v18.0/dialog/oauth?client_id=xxx&redirect_uri=xxx&state=xxx&scope=xxx"
}

2. Facebook 인증 페이지로 리다이렉트

프론트엔드에서 받은 OAuth URL로 사용자를 리다이렉트합니다.

window.location.href = oauthUrl;

사용자는 Facebook 로그인 후 Instagram Business 계정 접근 권한을 허용합니다.

3. 프론트엔드 Callback 수신

Facebook이 사용자를 프론트엔드 callback URL로 리다이렉트합니다.

https://your-frontend.com/instagram/callback?code=AUTH_CODE&state=STATE_VALUE
파라미터설명
codeAuthorization code (토큰 교환용)
stateCSRF 방지용 state 값 (memberId 포함)

4. 백엔드에 code 전달

프론트엔드가 받은 code와 state를 백엔드 API로 전달합니다.

POST /ai/instagram/oauth/connect?code=AUTH_CODE&state=STATE_VALUE

응답:

{
  "status": 200,
  "message": "Instagram 계정이 연결되었습니다.",
  "data": [
    {
      "accountId": 1,
      "username": "my_instagram",
      "name": "My Instagram Account",
      "profilePictureUrl": "https://...",
      "followersCount": 10000,
      "connectionStatus": "CONNECTED"
    }
  ]
}

플로우 다이어그램

┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   프론트    │     │   백엔드    │     │  Facebook   │     │  Instagram  │
└──────┬──────┘     └──────┬──────┘     └──────┬──────┘     └──────┬──────┘
       │                   │                   │                   │
       │ 1. GET /oauth/url │                   │                   │
       │──────────────────>│                   │                   │
       │                   │                   │                   │
       │   OAuth URL 반환  │                   │                   │
       │<──────────────────│                   │                   │
       │                   │                   │                   │
       │ 2. 리다이렉트     │                   │                   │
       │───────────────────────────────────────>                   │
       │                   │                   │                   │
       │                   │    사용자 인증    │                   │
       │                   │    권한 허용      │                   │
       │                   │                   │                   │
       │ 3. Callback (code, state)             │                   │
       │<──────────────────────────────────────│                   │
       │                   │                   │                   │
       │ 4. POST /oauth/connect                │                   │
       │──────────────────>│                   │                   │
       │                   │                   │                   │
       │                   │ 5. Token 교환     │                   │
       │                   │──────────────────>│                   │
       │                   │                   │                   │
       │                   │   Access Token    │                   │
       │                   │<──────────────────│                   │
       │                   │                   │                   │
       │                   │ 6. 프로필 조회    │                   │
       │                   │───────────────────────────────────────>
       │                   │                   │                   │
       │                   │   Instagram 정보  │                   │
       │                   │<──────────────────────────────────────│
       │                   │                   │                   │
       │  연결된 계정 반환 │                   │                   │
       │<──────────────────│                   │                   │
       │                   │                   │                   │

엔드포인트 목록

메서드경로설명인증
GET/ai/instagram/oauth/urlOAuth URL 조회불필요
POST/ai/instagram/oauth/connectInstagram 계정 연결불필요
GET/ai/instagram/accounts연결된 계정 목록 조회불필요
DELETE/ai/instagram/accounts/{accountNo}계정 연결 해제불필요
POST/ai/instagram/accounts/{accountNo}/sync계정 정보 동기화불필요

Response 스키마

SocialAccountDto

필드명타입설명
accountIdlong계정 ID
platformint플랫폼 (1: Instagram)
platformUserIdstringInstagram Business Account ID
usernamestringInstagram 사용자명 (@없이)
namestring계정 이름
profilePictureUrlstring프로필 이미지 URL
biographystring소개글
websitestring웹사이트 URL
followersCountlong팔로워 수
followingCountlong팔로잉 수
mediaCountlong게시물 수
connectionStatusSocialConnectionStatus연결 상태
priceTierstring가격 티어 (N/S/A/B/C 등)
priceint산정 가격

SocialConnectionStatus

설명
CONNECTED연결됨
DISCONNECTED연결 해제됨
EXPIRED토큰 만료
ERROR오류

OAuth

계정 관리

On this page