lib/aptible/auth/token.rb
# Unlike other resources, tokens aren't created in a REST fashion.
# Instead, they're created via OAuth grants. This means we need to
# override the way HyperResource / aptible-resource normally do things
# and plug in an OAuth library.
#
# To do so, we take control of the creation arguments and feed them into
# the OAuth2 library (in Token.create!), and then feed the response back
# to HyperResource (in Token#apply_oauth_response).
Unlike other resources, tokens aren't created in a REST fashion.
Instead, they're created via OAuth grants. This means we need to
override the way HyperResource / aptible-resource normally do things
and plug in an OAuth library.

To do so, we take control of the creation arguments and feed them into
the OAuth2 library (in Token.create!), and then feed the response back
to HyperResource (in Token#apply_oauth_response).
Unlike other resources tokens aren ' t created in a REST fashion . Instead they ' re created via OAuth grants . This means we need to override the way HyperResource / aptible - resource normally do things and plug in an OAuth library . To do so we take control of the creation arguments and feed them into the OAuth2 library ( in Token . create! ) and then feed the response back to HyperResource ( in Token#apply_oauth_response ) .
def authenticate_client(id, secret, subject, options = {})
        options[:scope] ||= 'manage'
        expires_in = options.delete(:expires_in)
        options[:exp] = Time.now.utc.to_i + expires_in if expires_in
        oauth_token = oauth.assertion.get_token({
          iss: id,
          sub: subject
        }.merge(signing_params_from_secret(secret).merge(options)))
        apply_oauth_response(oauth_token)
      end
def authenticate_client ( id , secret , subject , options = { } ) options [ :scope ] ||= 'manage' expires_in = options . delete ( :expires_in ) options [ :exp ] = Time . now . utc . to_i + expires_in if expires_in oauth_token = oauth . assertion . get_token ( { iss : id , sub : subject } . merge ( signing_params_from_secret ( secret ) . merge ( options ) ) ) apply_oauth_response ( oauth_token ) end
Unlike other resources, tokens aren't created in a REST fashion.
Unlike other resources tokens aren ' t created in a REST fashion .
# Unlike other methods, the assertion token grant requirs an "exp" # parameter rather than expires_in, but since we'd like to expose a # consistent API to consumers, we override it here
id
secret
subject
options