HTTP client abstraction layer for Auth Application RFC
Add these lines to your application's Gemfile:
source 'https://rubygems.pkg.github.com/itsmechlark' do
gem 'http-auth0'
end
And then execute:
$ bundle
HTTP::Auth0.configure do |auth0|
auth0.domain = 'insert-domain-here.jp.auth0.com'
auth0.client_id = 'insert-client-id-here'
auth0.client_secret = 'insert-client-secret-here'
end
require 'faraday'
require 'faraday/net_http'
require 'http/auth0/middleware'
conn = Faraday.new do |f|
f.use HTTP::Auth0::Middleware
end
conn.post("https://example.com/graphql")
require 'http/auth0'
require 'net/http'
uri = URI("https://example.com/graphql")
req = Net::HTTP::Get.new(uri)
req['Authorization'] = HTTP::Auth0.token(aud: uri.to_s)
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
http.request(req)
end
puts res.body
- Clone the http-auth0 repo
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request