API 레퍼런스

now.gg 계정 서비스 관련 API 레퍼런스입니다.

토큰 인증 API

토큰 인증 API의 세부 사항입니다.

기본 URL

https://now.gg

설명

해당 API는 생성된 토큰을 인증하는 데 사용됩니다.

요청 함수

POST

요청 경로

/accounts/oauth2/v1/verify-token

요청 헤더

Content-Type: application/json

요청 바디

다음 매개변수들을 Verify API의 요청 본문에 사용해야 합니다:

{
     token_type: <token_type>,
     token: <token>,
     client_id: <client_id>,
     client_secret: <client_secret>
 }

요청 바디 변수

이름 필요 허용 값 설명
token_type string True id_token, token 요청된 토큰 유형
token string True id_token, token 유효한 id_token 또는 now.gg에서 생성된 토큰
client_id string True Oauth client_id now.gg 계정 관리자를 통해 생성된 고유 client_id
client_secret string 토큰 형이 토큰인 경우 True,
토큰 형이 id_token인 경우 False
Oauth client_secret now.gg 계정 관리자를 통해 생성된 고유한 client_secret

중요 정보

  • OAuth 자격 증명 (client_idclient_secret)은 이 섹션을 통해 요청할 수 있습니다.
  • id_token: 사용자의 신원을 확인하기 위해 인증에 사용됩니다. 사용자 및 인증 이벤트에 대한 세부 정보를 제공합니다.
    • id_token기본 로그인 흐름에 사용됩니다.
    • 이 흐름은 대부분의 앱에 충분합니다. 그러나 앱이 고급 통합이 필요한 경우, 토큰 기반의 고급 로그인 통합 흐름을 통합할 수 있습니다.
  • token: 보호된 리소스(API)에 대한 액세스를 승인하는 데 사용됩니다. 클라이언트가 사용자를 대신하여 수행할 수 있는 작업을 결정합니다.

예상 응답

성공

{ 
     "success": true, 
     "code": "VERIFICATION_SUCCESS", 
     "decodedData": {}, 
     "msg": "Token Verification success" 
 }

실패

{ 
     "success": false, 
     "code": "EXPIRED_TOKEN", 
     "msg": "Token Expired!" 
 }
{
    "success": false,
    "code": "INVALID_TOKEN",
    "msg": "Token Invalid for given ClientId/ClientSecret"
 }

응답 변수

이름 허용 값 설명
success boolean True, False 결과를 True 또는 False로 반환합니다.
code string VERIFICATION_SUCCESS
INVALID_TOKEN
EXPIRED_TOKEN
VERIFICATION_SUCCESS: client_id/client_secret 토큰 인증 성공
INVALID_TOKEN: client_id 토큰 형식이 잘못되었거나 ‘aud’가 client_id와 일치하지 않음
EXPIRED_TOKEN: 토큰 만료
msg string Token Verification Success
Token Expired
Token Invalid for given ClientId/ClientSecret
성공/실패를 설명하는 유저 친화적인 메시지 – 반환된 코드와 연결됨
decodedData dict/obj 성공 후 반환된 디코딩된 데이터

디코딩된 데이터 샘플

1. id_token으로 반환

{ 
      "iss": 'https://now.gg', // id_token 발행자
      "sub": <>, <sub>, 
      "aud": client_id,// 토큰이 생성된 앱의 id
      "exp": <>,// 토큰이 만료되는 시간
      "iat": <>, // 토큰 발행 에포크 타임스탬프
      "auth_time": <>, // 인증이 완료된 시간
      "email": <>, // 유저 이메일
      "mobile": <> // 국가 코드 접두어가 있는 유저 모바일
      "userId": <> // 고유 유저 식별자
      "name": <>, // 유저 이름
      "picture": <>, // 프로필 이미지 URL
      "countryCode":<>, // 유저 국가 코드
 }

2. 토큰으로 반환

{ 
       "iss": "https://now.gg", // 토큰 발행자 
       "tokenId": "token_id", // token_id 
       "aud": "client_id", // client_id 
       "sessionId": "sessionId", // session Id 
       "userId": "userId" , // user Id
       "scope": "email", // 인증 범위: email/profile/authorization 
       "iat": 1636779002, 
       "exp": 1636782602 
 }

디코딩된 데이터 변수

이름 허용 설명
Iss string id_token, token 토큰 발행자
sub string id_token uuid/ulid를 반영하는 임의의 고유 문자열
aud string id_token, token 토큰이 생성되는 고유한 client_id
picture string id_token 프로필 이미지 URL
exp int id_token, token 토큰이 만료되는 시간
iat int id_token, token 토큰 발행 에포크 타임스탬프
auth_time int id_token 인증이 완료된 시간
email string id_token 계정과 연결된 유저의 이메일 주소
mobile string id_token 접두어(국가명)가 추가된 유저의 휴대폰 번호
userId string id_token, token 고유 유저 식별자
name string id_token 유저 이름
countryCode string id_token 유저 국가 코드
tokenId string token 반환된 토큰의 tokenId
sessionId string token 인증 세션 ID
scope string token 인증 범위: 이메일/프로필/인증

토큰 생성 API

토큰 생성 API의 세부 사항입니다.

기본 URL

https://now.gg

설명

인증 코드를 사용하여 tokenrefresh_token을 생성하는 데 사용되는 API입니다.

요청 함수

POST

요청 경로

/accounts/oauth2/v1/token

요청 헤더

Content-Type: application/json

요청 바디

tokenrefresh_token을 생성하려면 토큰 생성 API와 함께 다음 요청 바디를 사용해야 합니다.

중요: refresh_token을 사용하여 토큰을 생성하는 경우 여기를 확인해 주세요.

{
  client_secret: '<your_oauth_client_secret>',
  client_id: '<your_oauth_client_id>',
  grant_type: 'code',
  code:  '<authorization_code received via account manager>',
  token_type: '<refresh_token token>',
}

요청 바디 변수

이름 필요 허용 값 설명
token_type string true refresh_token, token 요청된 토큰 유형
grant_type string true code 코드 유형
code string true Auth Code 계정 관리자를 통해 받은 authorization_code
client_id string true OAuth client_id 고유 OAuth client_id
client_secret string true OAuth client_secret 고유 OAuth client_secret

참고: OAuth 자격 증명 (client_idclient_secret)은 이 섹션을 통해 요청할 수 있습니다.

예상 응답

{
 "success": true,
 "code": "REFRESH_TOKEN TOKEN",
 "token": "<token>", // Authorization Header에 사용될 토큰입니다.
 "refresh_token": "<refresh_token>", // 토큰이 만료되면 새 토큰을 생성하는데 사용됩니다.
 "token_expiry": "<token_expiry_time>", // 토큰 만료 시간
 "refresh_token_expiry": "<refresh_token_expiry>" // refresh_token 만료 시간
 }

응답 변수

이름 설명
success boolean true – 성공
false – 실패
code string REFRESH_TOKEN TOKEN
token string Authorization 헤더에 사용되는 토큰
refresh_token string 토큰이 만료되면 새 토큰을 생성하는 데 사용
token_expiry string 반환된 토큰 만료 시간
refresh_token_expiry string 반환된 refresh_token 만료 시간

refresh_token으로 토큰 생성

token이 만료된 경우 refresh_token을 사용하여 토큰을 생성할 수 있습니다.

요청 바디

{
  client_secret: '<your_oauth_client_secret>',
  client_id: '<your_oauth_client_id>',
  grant_type: 'refresh_token',
  refresh_token:  '<refresh_token>',
  token_type: '<token>',
}

요청 변수

이름 필요 허용 값 설명
token_type string true token 요청된 토큰 유형
grant_type string true refresh_token refresh_token 유형
refresh_token string true refresh_token 이전에 생성한 Refresh_token
client_id string true OAuth client_id 고유 OAuth client_id
client_secret string true OAuth client_secret 고유 OAuth client_secret

예상 응답

{
 "success": true,
 "code": "<REFRESH_TOKEN TOKEN>",
 "token": "<token>", // Authorization Header에 사용될 토큰입니다.
 "token_expiry": "<token_expiry>", // 토큰 만료 시간
 }

응답 변수

이름 설명
success boolean True – 성공
False – 실패
code string REFRESH_TOKEN TOKEN
token string Authorization 헤더에 사용되는 토큰
token_expiry string 반환된 토큰 만료 시간

유저 정보 API

유저 정보 API 세부 사항입니다.

기본 URL

https://now.gg

설명

해당 API는 유저 정보를 가져오는 데 사용됩니다.

요청 함수

GET

요청 경로

/accounts/users/v1/userinfo

요청 헤더

헤더 내에 인증을 위해 Bearer Token을 포함해야 합니다.

{ Authorization: 'Bearer Token'}

예상 응답

User Info API를 사용하여 유저 데이터를 가져올 시 다음 예상 응답이 반환됩니다.

{
  success: true,
  code: 'USERDATA',
  userData: {
      email: '', // 유저 이메일 주소
      mobile: '', // 유저 휴대폰 번호
      userId: '', // 유저 userId
      profilePicture: '', // 프로필 이미지 URL
      name: '', // 유저 이름
      countryCode: 'IN', // 유저 국가 코드
      country: '', // 유저 국가
      countryRegionCode: '', // 유저 국가 지역 코드
      countryRegion: '', // 유저 국가 지역
      city: '', // 유저 도시
      postalCode: '', // 유저 우편번호
  },
}

응답 변수

이름 설명
success boolean True – 성공
False – 실패
email string 유저 이메일 주소
mobile string CountryCode가 접두어로 추가된 유저의 휴대폰 번호
userId string 유저 계정의 고유 식별자
profilePicture string 유저 프로필 이미지의 URL
name string 유저 이름
countryCode string 유저 국가 코드
country string 유저 국가
countryRegionCode string 유저 국가 지역 코드
countryRegion string 유저 국가 지역
city string 유저 도시
postalCode string 유저 우편번호
code string USERDATA – 유저 정보

세션 정보 API

세션 정보 API의 세부 사항입니다.

기본 URL

https://now.gg

설명

해당 API는 유저의 세션 정보를 가져오는 데 사용됩니다.

요청 함수

GET

요청 경로

/accounts/users/v1/sessioninfo

요청 헤더

헤더 내에 인증을 위해 Bearer Token을 포함해야 합니다.

{ Authorization: 'Bearer Token'}

예상 응답

Session Info API를 사용하여 세션 데이터를 가져올 시 다음 예상 응답이 반환됩니다.

{
   success: true,
   code: 'USERDATA',
   sessionData: {
       userAgent: '', // 유저 에이전트 정보
       ip: '', // 유저 ip
       locale: 'en-GB', // 유저 locale
       deviceData: {
           os: {
               version: '', // OS 버전
               name: '',   // OS 이름
               platform: '', // OS 플랫폼
          },
           device: {
               brand: '', // 기기 브랜드 정보
               model: '', // 기기 모델 정보
               type: 'desktop', // 기기 유형
          },
           client: {
               version: '', // 클라이언트 버전
               engine: '', // 클라이언트 엔진
               name: '', // 클라이언트 이름
               type: '', // 클라이언트 유형
               engineVersion: '', // 클라이언트 엔진 버전
          },
      },
       geoData: {
           countryCode: '', // 유저 국가 코드
           country: '', // 유저 국가
           countryRegionCode: '', // 유저 국가 지역 코드
           countryRegion: '', // 유저 국가 지역
           city: '', // 유저 도시
           postalCode: '', // 유저 우편번호
      },
       lastSessionTimestamp: '', // 세션 타임스탬프
       packageName: '', // 패키지 이름
  },
}

응답 변수

이름 설명
success boolean True – 성공
False – 실패
code string USERDATA – 세션 정보
lastSessionTimestamp string 마지막 세션 타임스탬프
packageName string 패키지 이름

세션 데이터 변수

이름 설명
userAgent string User-Agent 정보
ip string 유저 IP
locale string 유저 Locale

기기 데이터 변수

이름 설명
OS
version string 유저 운영 체제의 버전
name string 유저 운영 체제의 이름
platform string 유저 운영 체제의 플랫폼
Device
brand int 유저 기기의 브랜드
model int 유저 기기의 모델
type string 기기 유형
Client
version string 클라이언트 버전
engine string 클라이언트 엔진
name string 클라이언트 이름
type string 클라이언트 유형
engineVersion string 클라이언트 엔진 버전

위치 데이터 변수

이름 설명
countryCode string 유저 국가 코드
country string 유저 국가
countryRegionCode string 유저 국가 지역 코드
countryRegion string 유저 국가 지역
city string 유저 도시
postalCode string 유저 우편번호

×
클립보드에 복사된 텍스트
copyLinkText
질문이 있으신가요? 다음 주소로 문의하세요. dev-support@now.gg