APIリファレンス

このセクションには、now.gg ユーザーアカウントサービスの APIリファレンスが含まれています。

Verify Token API

このドキュメントでは、Verify Token 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 Valid id_tokenまたはnow.ggによって生成されたトークン
client_id String True Oauth client_id now.ggアカウントマネージャーで生成された固有のclient_id
client_secret String True, If token type is token
False, If token type is id_token
Oauth client_secret now.ggアカウントマネージャーで生成された固有のclient_secret

予想されるレスポンス

成功

{ 
     "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: トークンが不正であるか「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', // issuer of id_token,   
      "sub": <>, <sub>, 
      "aud": client_id,//  of App for which token is generated 
      "exp": <>,// time at which token expires 
      "iat": <>, // token issued epoch timestamp 
      "auth_time": <>, // time at which authentication was done 
      "email": <>, // user email id 
      "mobile": <> // user mobile with country code prefix 
      "userId": <> // unique user identifier 
      "name": <>, // user full name 
      "picture": <>, // profile picture url
      "countryCode":<>, // country code of the user
 }

2. Tokenを使用して返されるデコードされたデータ

{ 
       "iss": "https://now.gg", // issuer of token 
       "tokenId": "token_id", // token_id 
       "aud": "client_id", // client_id 
       "sessionId": "sessionId", // session Id 
       "userId": "userId" , // user Id
       "scope": "email", // scope of authorization: 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 トークン発行のEpochタイムスタンプ
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 返されたトークンのトークンId
sessionId String token 認証のセッションID
scope String token 承認の範囲:メールアドレス/プロフィール/承認

 

Generate Tokens API

このドキュメントでは、Generate Tokens APIの詳細と使用方法を中心に説明します。

ベースURL

https://now.gg

概要

このAPIは、認証コードを使用してtokenrefresh_tokenを生成するために使用されます。

リクエストメソッド

POST

リクエストパス

/accounts/oauth2/v1/token

リクエストヘッダー

Content-Type: application/json

リクエストボディ

tokenおよびrefresh_tokenを生成するには、Generate Tokens APIで以下のリクエストボディを使用します。

注意: refresh_tokenを使用して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

予想されるレスポンス

{
 "success": true,
 "code": "REFRESH_TOKEN TOKEN",
 "token": "<token>", // token to be used in the Authorization Header.
 "refresh_token": "<refresh_token>", // to generate new token, when token expires.
 "token_expiry": "<token_expiry_time>", // token expiry time
 "refresh_token_expiry": "<refresh_token_expiry>" // refresh_token expiry time
 }

レスポンスパラメータ

Params Type Description
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 リクエストされた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>", // token to be used in the Authorization Header.
 "token_expiry": "<token_expiry>", // token expiry time
 }

レスポンスパラメータ

パラメータ タイプ 説明文
success Boolean True – 操作の成功
False – 操作の失敗
code String REFRESH_TOKEN TOKEN
token String Authorizationヘッダーで使用されるトークン
token_expiry String 返されたトークンの有効期限

User Info API

このドキュメントでは、User Info 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: '', // email address of the user
      mobile: '', // mobile number of the user
      userId: '', // userId of the user
      profilePicture: '', // Profile picture URL
      name: '', // name of the user
      countryCode: 'IN', // country code of the user
      country: '', // country of the user
      countryRegionCode: '', // country region code of the user
      countryRegion: '', // country region of the user
      city: '', // city name of the user
      postalCode: '', // postal code of the user
  },
}

レスポンスパラメータ

パラメータ タイプ 説明文
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 – ユーザー情報

 

Session Info API

このドキュメントでは、Session Info APIの詳細と使用方法を説明します。

ベースURL

https://now.gg

概要

このAPIは、ユーザーのセッション情報を取得するために使用します。

リクエストメソッド

GET

リクエストパス

/accounts/users/v1/sessioninfo

リクエストヘッダー

ヘッダー内に認証用のBearer Tokenを含める必要があります。

{ Authorization: 'Bearer Token'}

予想されるレスポンス

セッション情報APIを使用してセッションデータを取得する場合、以下のレスポンスが予想されます。

{
   success: true,
   code: 'USERDATA',
   sessionData: {
       userAgent: '', // user agent information
       ip: '', // ip address of the user
       locale: 'en-GB', // locale of the user
       deviceData: {
           os: {
               version: '', // OS version
               name: '',   // OS name
               platform: '', // OS platform
          },
           device: {
               brand: '', // Device brand information
               model: '', // Device model information
               type: 'desktop', // Type of Device
          },
           client: {
               version: '', // Client version
               engine: '', // Client engine
               name: '', // Client name
               type: '', // Type of client
               engineVersion: '', // Engine version of the client
          },
      },
       geoData: {
           countryCode: '', // Country code of the user
           country: '', // Country of the user
           countryRegionCode: '', // Country region of the user
           countryRegion: '', // Region of the user
           city: '', // City of the user
           postalCode: '', // Postal code of the user
      },
       lastSessionTimestamp: '', // Session timestamp
       packageName: '', // Name of the package
  },
}

レスポンスパラメータ

パラメータ タイプ 説明文
success Boolean True – 操作の成功
False – 操作の失敗
code String USERDATA – セッション情報
lastSessionTimestamp String 最後のセッションのタイムスタンプ
packageName String パッケージ名

セッションデータパラメータ

パラメータ タイプ 説明文
userAgent String ユーザーエージェント情報
ip String ユーザーのIPアドレス
locale String ユーザーのロケール

デバイスデータパラメータ

パラメータ タイプ 説明文
OS
version String ユーザーのOSのバージョン
name String ユーザーのOS名
platform String ユーザーのOSのプラットフォーム
Device
brand Int ユーザーのデバイスのブランド
model Int ユーザーのデバイスのモデル
type String デバイスのタイプ
Client
version String クライアントバージョン
engine String クライアントエンジン
name String クライアント名
type String クライアントのタイプ
engineVersion String クライアントのエンジンバージョン

地域データパラメータ

Params Type Description
countryCode String ユーザーの国コード
country String ユーザーの国
countryRegionCode String ユーザーの国地域(州)コード
countryRegion String ユーザーの国地域(州)
city String ユーザーの都市
postalCode String ユーザーの郵便番号

×
テキストがクリップボードにコピーされました。
copyLinkText
ご不明な点がございましたら、お気軽にお問い合わせください。 dev-support@now.gg