Skip to content

An example of how to connect to the Kobas API using OAuth 2.0 authentication and Ruby.

License

Notifications You must be signed in to change notification settings

KOBASSoftware/oauth2-ruby-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OAuth 2.0 & Ruby Kobas Example

require 'oauth2'

client_id = '' # Provided by Kobas
client_secret = '' # Provided by Kobas
client_scopes = '' # Provided by Kobas
kobas_company_id = '' # Provided by Kobas

oauth_domain = 'https://oauth.kobas.co.uk' # Will only change if you are using Kobas training mode.
api_domain = 'https://api.kobas.co.uk/v3' # Will only change if you are using Kobas training mode.


# Setup the client
client = OAuth2::Client.new(client_id, client_secret, :site => oauth_domain, :authorize_url => '/authorize', :token_url => '/access_token', :connection_opts => {:headers => {'x-kobas-company-id' => kobas_company_id}})

# Request the token
token = client.client_credentials.get_token({:scope => client_scopes}, :headers => {'x-kobas-company-id' => kobas_company_id})

# Make API request using token
response = token.get(api_domain + '/venue', :headers => {'x-kobas-company-id' => kobas_company_id})

## The result
print response.body

About

An example of how to connect to the Kobas API using OAuth 2.0 authentication and Ruby.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages