Simplest possible example of using ruby to access our authenticated API
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Gemfile ensure that json is also installed. Apr 27, 2017
Gemfile.lock update rack to 2.0.6 for security fix Dec 11, 2018
LICENSE
README.md add very basic example of using the csl api. Apr 26, 2017
example.rb remove byebug require, was just there for debugging. Apr 27, 2017

README.md

oauth-api-example

Simplest possible example of using ruby to access our authenticated API

Background

This example uses the client_credentials oauth authentication scheme and the oauth2 ruby gem. There are similar libraries for almost every language: https://oauth.net/code/

For a detailed description of how the client credentials flow works under the covers, you can read the docs from the OAuth standard: https://tools.ietf.org/html/rfc6749#section-4.4

We also support the authorization token flow, but the simpler client credentials flow is recommended in most cases.

Usage

  1. Checkout this repository to your local machine.
  2. Install ruby and bundler.
  3. run bundle install to install the gems that the script depends on.
  4. edit example.rb to use the url, client id and client secret from your organization's API credentials page. The url should be the URL of the site you are attempting to access. The client id and secret are provided via the api credentials screen.
  5. run ruby example.rb If there is a user with the specified email address present, it's account details will be printed.