Skip to content
jmiranda edited this page Sep 8, 2014 · 1 revision

Getting Started

Install the CATCH server

See README.md.

Log into the CATCH server dashboard

  1. Log into the CATCH dashboard (http://localhost:8080/catch/dashboard/index).
  2. The default username is admin, default password: password.

Create new API Client

  1. Click on the Create System link.
  2. Enter a name (e.g. Sample Client), short name (e.g. sample-client) and description (include URL of the client if it exists).
  3. Click the Save System button.
  4. Copy the API Key.

Generate JSON Web Token (JWT)

Every request made to the API needs a valid JSON Web Token. This token can be generated in various ways. Here's one way that I have found to generate a quick JWT to use for testing. The actual annotatorjs client should be able to generate a JWT dynamically. See the following documentation for more information (http://docs.annotatorjs.org/en/latest/authentication.html).

  1. Go to http://openidtest.uninett.no/jwt
  2. Copy the following JWT Claims into the Unpacked JWT textarea. Use the API key that you copied after creating a new System in the previous step. The username should be the email of the user sending the request.
  3. Click the Encode button to generate your JWT.
  4. Copy the value in the Encoded JWT textarea.

Example Unpacked JWT

{
"userId": "<username>",
"consumerKey": "<api-key>",
"ttl": 86400,
"issuedAt": "2014-09-08T17:28:30+00:00"
}

Example Encoded JWT

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJqbWlyYW5kYSIsImNvbnN1bWVyS2V5IjoiNWE1YjU5NzEtMWJmYy00ZTliLTg5NDItMDlhYzQzOTIyYTQ0IiwidHRsIjo4NjQwMCwiaXNzdWVkQXQiOiIyMDE0LTA5LTA4VDE3OjI4OjMwKzAwOjAwIiwidHlwIjoiSldUIn0.bUPKYZdt4lHBsnR-8glGEPqWsMwKwAhupl9Q_OHvzdE

Validate JWT

  1. You can also verify the token by decoding the JWT string from above on the following page (https://developers.google.com/wallet/digital/docs/jwtdecoder).
  2. Copy your newly generated JWT string into the textarea.
  3. Click the Decode JWT button.
  4. You should see the same Claims that you entered above.
Header
{
    "alg": "HS256", 
    "typ": "JWT"
}
Claims
{
    "issuedAt": "2014-09-08T17:28:30+00:00", 
    "typ": "JWT", 
    "consumerKey": "5a5b5971-1bfc-4e9b-8942-09ac43922a44", 
    "userId": "jmiranda", 
    "ttl": 86400
}
Signature (encoded)
bUPKYZdt4lHBsnR-8glGEPqWsMwKwAhupl9Q_OHvzdE