README

Developer Setup

  • Clone repository
  • Ensure ruby version is set to version in .ruby-version file

In your terminal:

$ git clone git@github.com:eknowlton/api.testmy.dev.git && cd api.testmy.dev
$ cat .ruby-version
# Ensure your ruby version matches, use `rbenv` to manage multiple ruby versions
$ ruby bin/development.rb

Authentication

We use token authentication, where a user has a token generated for them. Two tokens are returned on a successful sign in. The access token is used in a traditional way to access all apps within the Kimmel ecosystem. To make authenticated queries add Authorization with the access token string to the headers.

Example HTTP Headers

Authorization: ccDqq8GpZvkcDLi9eGR6ZNjn

GraphQL variables and query for sign in to the test account:

mutation ($input: SignInUserInput!) {
  signInUser(input: $input) {
    refreshToken
    accessToken
    user {
      email
    }
    errors {
      field
      message
    }
  }
}

# variables
{
  input: {
    "email": "test@kimmel.com",
    "password": "Tester12"
  }
}

The second token type is a refresh token which is used to talk back to testmydev and get new tokens issued when the access token has expired.

Example GraphQL variables and query for refresh token mutation:

mutation($input: RefreshTokensInput!) {
  refreshTokens(input: $input) {
    refreshToken
    accessToken
    user {
      email
    }
    errors {
      field
      message
    }
  }
}

# variables
{
  input: {
    "refreshToken": "ccDqq8GpZvkcDLi9eGR6ZNjn"
  }
}