Skip to content

Simplest possible example of using ruby to access our authenticated API

License

Notifications You must be signed in to change notification settings

controlshift/oauth-api-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Simplest possible example of using ruby to access our authenticated API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages