Ruby client for auth.aptible.com. Aptible's authorization server is built on top of OAuth 2.0 and HAL+JSON, and so this client is just a thin layer on top of the oauth2 and HyperResource gems.
Add the following line to your application's Gemfile.
gem 'aptible-auth'
And then run bundle install
.
First, get a token:
token = Aptible::Auth::Token.create(email: '[email protected]', password: 'password')
From here, you can interact with the Authorization API however you wish:
auth = Aptible::Auth.new(token: token)
auth.clients.first.name
# => "Client 0"
client = Aptible::Auth::Client.create(token: token, name: 'Dogeclient')
client.href
# => "http://localhost:4000/clients/60765b69-ffd8-4762-b9d2-96354ddb16f9"
Parameter | Description | Default |
---|---|---|
root_url |
Root URL of the authorization server | ENV['APTIBLE_AUTH_ROOT_URL'] or https://auth.aptible.com |
To point the client at a different authorization server (e.g., during development), add the following to your application's initializers (or set the APTIBLE_AUTH_ROOT_URL
environment variable):
Aptible::Auth.configure do |config|
config.root_url = 'http://some.other.url'
end
- Fork the project.
- Commit your changes, with specs.
- Ensure that your code passes specs (
rake spec
) and meets Aptible's Ruby style guide (rake rubocop
). - Create a new pull request on GitHub.
MIT License, see LICENSE for details.
Copyright (c) 2019 Aptible and contributors.