Project

http-auth0

0.0
The project is in a healthy, maintained state
Faraday adapter for Auth0
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0.14, < 2.0
>= 2.3, < 2.8
 Project Readme

http-auth0

CI Gem Version Coverage Status Maintainability

HTTP client abstraction layer for Auth Application RFC

Installation

Add these lines to your application's Gemfile:

source 'https://rubygems.pkg.github.com/itsmechlark' do
  gem 'http-auth0'
end

And then execute:

$ bundle

Usage

Configure the gem in an initializer

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

Use with your preferred HTTP client

Faraday Example

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")

Net::HTTP Example

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

Dependencies

Contributing

  1. Clone the http-auth0 repo
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request