API Reference

This section contains the API References for now.gg User Account Service.

Verify Token API

This document focuses on Verify Token API details and usage.

Base URL

https://now.gg

Description

This API is used to verify the generated token.

Request Method

POST

Request Path

/accounts/oauth2/v1/verify-token

Request Header

Content-Type: application/json

Request Body

The following params should be used within the request body with Verify API:

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

Request Body Parameters

Params Type Required Allowed Values Description
token_type String True id_token, token Type of token requested
token String True id_token, token Valid id_token or token generated by now.gg
client_id String True Oauth client_id Unique client_id generated with now.gg account manager
client_secret String True, If token type is token
False, If token type is id_token
Oauth client_secret Unique client_secret generated with now.gg account manager

Expected Response

Success

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

Failure

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

Response Parameters

Params Type Possible Value Description
success Boolean True, False Returns results as True or False
code String VERIFICATION_SUCCESS
INVALID_TOKEN
EXPIRED_TOKEN
VERIFICATION_SUCCESS: token verification successful against client_id/client_secret
INVALID_TOKEN: Token malformed or ‘aud’ does not match with your client_id
EXPIRED_TOKEN: Token Expired
msg String Token Verification Success
Token Expired
Token Invalid for given ClientId/ClientSecret
User-friendly message depicting success/failure – associated with returned code
decodedData dict/obj Decoded Data returned after success

Example of Decoded Data

1. Decoded Data returned using 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. Decoded Data returned using 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 
 }

Decoded Data Parameters

Params Type Available In Description
Iss String id_token, token Issuer of Token
sub String id_token Random unique string reflecting the uuid/ulid
aud String id_token, token Unique client_id for which the token is generated
picture String id_token URL of the profile picture of the user
exp Int id_token, token Request Validity – time at which token expires
iat Int id_token, token Token issued epoch timestamp
auth_time Int id_token Time at which authentication was done
email String id_token Email address of the user associated with the account
mobile String id_token User’s mobile number with an added prefix (country name)
userId String id_token, token Unique identifier for the user
name String id_token Full name of the user
countryCode String id_token Country code of the user
tokenId String token tokenId of the returned token
sessionId String token Session Id of Authorization
scope String token Scope of authorization: email/profile/authorization

 

Generate Tokens API

This document focuses on theĀ  Generate Tokens API details and usage.

Base URL

https://now.gg

Description

This API is used to generate token and refresh_token using an authorization code.

Request Method

POST

Request Path

/accounts/oauth2/v1/token

Request Header

Content-Type: application/json

Request Body

The following request body should be used with the Generate Tokens API to generate token and refresh_token.

Note: If you are generating a token using the refresh_token, use this section.

{
  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>',
}

Request Body Parameters

Params Type Required Allowed Values Description
token_type String True refresh_token, token Type of token requested
grant_type String True code Type of grant (code).
code String True Auth Code The authorization_code received via account manager.
client_id String True OAuth client_id Unique OAuth client_id.
client_secret String True OAuth client_secret Unique OAuth client_secret.

Expected Response

{
 "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
 }

Response Parameters

Params Type Description
success Boolean True – Operation Successful.
False – Operation Failed.
code String REFRESH_TOKEN TOKEN.
token String The token to be used in the Authorization header.
refresh_token String Used to generate a new token when the token expires.
token_expiry String Returned token expiry time.
refresh_token_expiry String Returned refresh_token expiry time.

Generate Token with refresh_token

If your token has expired, use refresh_token to generate the token.

Request Body

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

Request Parameters

Params Type Required Allowed Values Description
token_type String True token Type of token requested
grant_type String True refresh_token Type of grant (refresh_token).
refresh_token String True refresh_token The refresh_token you previously generated.
client_id String True OAuth client_id Unique OAuth client_id.
client_secret String True OAuth client_secret Unique OAuth client_secret.

Expected Response

{
 "success": true,
 "code": "<REFRESH_TOKEN TOKEN>",
 "token": "<token>", // token to be used in the Authorization Header.
 "token_expiry": "<token_expiry>", // token expiry time
 }

Response Parameters

Params Type Description
success Boolean True – Operation Successful.
False – Operation Failed.
code String REFRESH_TOKEN TOKEN.
token String The token to be used in the Authorization header.
token_expiry String Returned token expiry time.

User Info API

This document focuses on User Info API details and usage.

Base URL

https://now.gg

Description

This API is used to get the User Information associated with a user.

Request Method

GET

Request Path

/accounts/users/v1/userinfo

Request Header

You are required to include the Bearer Token for authorization within the header.

{ Authorization: 'Bearer Token'}

Expected Response

The following response is expected when using the User Info API to fetch the user data.

{
  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
  },
}

Response Parameters

Params Type Description
success Boolean True – Operation Successful.
False – Operation Failed.
email String Email address of the user.
mobile String Mobile number of the user with added CountryCode as a prefix.
userId String Unique identifier for the user account.
profilePicture String URL of the user’s profile picture.s
name String User’s full name.
countryCode String User’s country code
country String User’s country.
countryRegionCode String User’s country region(state) code.
countryRegion String User’s country region(state).
city String User’s city.
postalCode String User’s postal code.
code String USERDATA – User information.

 

Session Info API

This document focuses on Session Info API details and usage.

Base URL

https://now.gg

Description

This API is used to get the session information for a user.

Request Method

GET

Request Path

/accounts/users/v1/sessioninfo

Request Header

You are required to include the Bearer Token for authorization within the header.

{ Authorization: 'Bearer Token'}

Expected Response

The following response is expected when using the Session Info API to get the session data.

{
   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
  },
}

Response Parameters

Params Type Description
success Boolean True – Operation Successful.
False – Operation Failed.
code String USERDATA – Session information.
lastSessionTimestamp String Last session time stamp.
packageName String Name of the package.

Session Data Parameters

Params Type Description
userAgent String User-Agent information.
ip String IP Address of the user.
locale String Locale of the user.

Device Data Parameters

Params Type Description
OS
version String The version of user’s operating system.
name String Name of user’s operating system.
platform String The platform of user’s operating system.
Device
brand Int Brand of user’s device.
model Int Model of user’s device.
type String Type of device.
Client
version String Client version.
engine String Client engine.
name String Client name.
type String Type of client.
engineVersion String Client engine version.

Geo Data Parameters

Params Type Description
countryCode String User’s country code
country String User’s country.
countryRegionCode String User’s country region(state) code.
countryRegion String User’s country region(state).
city String User’s city.
postalCode String User’s postal code.

Ɨ

Document Rev. 1.0

Text copied to clipboard
Link copied to clipbord
Questions? Please reach out to us at dev-support@now.gg