This section contains the API References for now.gg User Account Service.
This document focuses on Verify Token API details and usage.
https://now.gg
This API is used to verify the generated token.
POST
/accounts/oauth2/v1/verify-token
Content-Type: application/json
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>
}
| 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. (More information) |
| 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 |
client_id and client_secret) can be requested using this section.id_token is used for the basic login flow.token is used for the advanced login integration flow.{
"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"
}
| 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 |
{
"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
}
{
"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
}
| 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 |
| 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 |
This document focuses on the Generate Tokens API details and usage.
https://now.gg
This API is used to generate token and refresh_token using an authorization code.
POST
/accounts/oauth2/v1/token
Content-Type: application/json
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>',
}
| 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. |
Note: The OAuth credentials (client_id and client_secret) can be requested using this section
{
"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 – 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. |
If your token has expired, use refresh_token to generate the token.
{
client_secret: '<your_oauth_client_secret>',
client_id: '<your_oauth_client_id>',
grant_type: 'refresh_token',
refresh_token: '<refresh_token>',
token_type: '<token>',
}
| 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. |
{
"success": true,
"code": "<REFRESH_TOKEN TOKEN>",
"token": "<token>", // token to be used in the Authorization Header.
"token_expiry": "<token_expiry>", // token expiry time
}
| 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. |
This document focuses on User Info API details and usage.
https://now.gg
This API is used to get the User Information associated with a user.
GET
/accounts/users/v1/userinfo
You are required to include the Bearer Token for authorization within the header.
{ Authorization: 'Bearer Token'}
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
},
}
| Params | Type | Description |
|---|---|---|
| success | boolean | True – Operation Successful. False – Operation Failed. |
| 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. |
This document focuses on Session Info API details and usage.
https://now.gg
This API is used to get the session information for a user.
GET
/accounts/users/v1/sessioninfo
You are required to include the Bearer Token for authorization within the header.
{ Authorization: 'Bearer Token'}
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
},
}
| 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. |
| Params | Type | Description |
|---|---|---|
| userAgent | string | User-Agent information. |
| ip | string | IP Address of the user. |
| locale | string | Locale of the user. |
| 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. |
| 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. |
User Account Service
User Account Service
Document Rev. 1.0