Api Methods


AuthenticateApiUser

/Api/AuthenticateApiUser

Parameters: jwt : String  

Required Claims:

exp Expiration date
iss Your assigned AppCode
jti Any unique value, may not be repeated
pwd The user's password
usr The user's username

Used for APIs to authenticate their users. Returns a JWT token which your application can to give to its callers and verify on its own with a jwt library. Don't use for GUI apps. WARNING: Your application must be authorized to use this method

Sample Response:

{
  "success": true,
  "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NDU1OTkzODIsImV4cCI6MTc0NTYxMzc4MiwidXNlcklkIjoidHN0X3NhbXBsZSIsImNsaWVudElkIjoidHN0IiwiZW1haWwiOiJzb21ldXNlckBzb21lZW1haWwuY29tIn0.mVJgyUmyhOF-kq_58S1QBhdX2T9DP6tJ-NUCIGW-4oQ"
}

Try It


AuthenticateApiUserWithSession

/Api/AuthenticateApiUserWithSession

Parameters: jwt : String  

Required Claims:

exp Expiration date
iss Your assigned AppCode
jti Any unique value, may not be repeated
pwd The user's password
usr The user's username

Used for APIs to authenticate their users. Returns a JWT token which your application can to give to its callers and verify on its own with a jwt library. Don't use for GUI apps. WARNING: Your application must be authorized to use this method

Sample Response:

{
  "success": true,
  "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NDU1OTkzODIsImV4cCI6MTc0NTYxMzc4MiwidXNlcklkIjoidHN0X3NhbXBsZSIsInN1YiI6InNlc3Npb25faWQiLCJjbGllbnRJZCI6InRzdCIsImVtYWlsIjoic29tZXVzZXJAc29tZWVtYWlsLmNvbSJ9.MVVsI-vwZVRobSAGotHSe6c5Dd8ITIuil2Edh1QJmD0"
}

Try It


ExtendSession

/Api/ExtendSession

Parameters: jwt : String   exh : Int32  

Required Claims:

sub Subject, the user's session key

Extend valid token session timeout by extension time in hours[1-4]. Refer this page for more details at https://wiki.office.comscore.com/display/CSD/JWT+Api+-+Extend+Session+endpoint

Sample Response:

{
  "success": true
}

Try It


Heartbeat

/Api/Heartbeat

Parameters: NONE

Checks if the system is online.

Sample Response:

{
  "isAlive": true
}

Try It


LoginUrl

/Api/LoginUrl

Parameters: NONE

Url to redirect user to if they do not have a valid session.

Sample Response:

{
  "loginUrl": "https://auth2.comscore.com/Authenticate.aspx"
}

Try It


LogoutUrl

/Api/LogoutUrl

Parameters: NONE

Url to redirect user to if you want them to be logged out.

Sample Response:

{
  "logoutUrl": "https://auth2.comscore.com/logout"
}

Try It


Session

/Api/Session

Parameters: sub : String   exh : Int32  

Checks if the session is still valid for the given identifier.

Sample Response:

{
  "isValid": false
}

Try It


ShareToken

/Api/ShareToken

Parameters: jwt : String   a : String  

Required Claims:

aud User audience
exp Expiration date
iat Issued at time
iss Your assigned AppCode
jti Any unique value, may not be repeated
nbf Not before time
sub Subject, the user's session key

Share token with registered app. Source app jwt token [jwt], Destination app code [a]. WARNING: Your application must be authorized to use this method

Sample Response:

{
  "success": true,
  "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NDU1OTkzODIsImV4cCI6MTc0NTYxMzc4MiwidXNlcklkIjoidHN0X3NhbXBsZSIsInN1YiI6InNlc3Npb25faWQiLCJjbGllbnRJZCI6InRzdCIsImVtYWlsIjoic29tZXVzZXJAc29tZWVtYWlsLmNvbSJ9.MVVsI-vwZVRobSAGotHSe6c5Dd8ITIuil2Edh1QJmD0"
}

Try It


User

/Api/User

Parameters: jwt : String  

Required Claims:

exp Expiration date
iss Your assigned AppCode
jti Any unique value, may not be repeated
sub Subject, the user's session key

Returns information about the user.

Sample Response:

{
  "userId": "tst_sample1999",
  "isComscore": false,
  "isImpersonation": false,
  "impersonator": null,
  "email": "tst_sample@mymetrix.com",
  "clientId": "tst",
  "groups": [
    "group1",
    "group2"
  ],
  "clientName": "Test Company",
  "UserFirstName": null,
  "UserLastName": null
}

Try It


ValidateToken

/Api/ValidateToken

Parameters: jwt : String  

You may optionally call this method if you do not have the facilities to thoroughly validate the token you recieved from the user. You should do at least minimum validation on your end before calling this. This method will also check that the session is valid. Remember, the same token will not be valid more than once.

Sample Response:

{
  "isValid": false,
  "message": "invalid token"
}

Try It