if ci_badges.map(&:color).detect { it != "green"} โ๏ธ let me know on Discord or RubyForum, as I may have missed the notification.
if ci_badges.map(&:color).all? { it == "green"} ๐๏ธ send money so I can do more of this. FLOSS maintenance is now my full-time job.
Corporate sponsor: Become a sponsor
Iโve summarized my thoughts in this blog post.
OAuth 1.0a is an industry-standard protocol for authorization. It is an update to the original OAuth 1.0 protocol, and is used by many popular services.
This is a RubyGem for implementing OAuth 1.0 or 1.0a clients and servers in Ruby applications.
See the sibling oauth2 gem for OAuth 2.0, 2.1, & OIDC clients in Ruby.
All dependencies of this gem are signed, so it can be installed with a HighSecurity profile.
This gem targets the OAuth 1.0a behavior (the errata that became RFC 5849), while maintaining compatibility with providers that still behave like classic 1.0. Here are the key differences between the two and how this gem handles them:
Practical guidance:
References: RFC 5849 (OAuth 1.0), sections 5โ7; 1.0a security errata.
Ruby OAuth has been maintained by a large number of talented individuals over the years. The primary maintainer since 2020 is Peter Boling (@pboling).
| Tokens to Remember | |
|---|---|
| Works with JRuby | |
| Works with Truffle Ruby | |
| Works with MRI Ruby 4 | |
| Works with MRI Ruby 3 | |
| Works with MRI Ruby 2 | |
| Support & Community | |
| Source | |
| Documentation | |
| Compliance | |
| Style | |
| Maintainer ๐๏ธ | |
... ๐ |
The gemโs declared runtime compatibility floor is MRI Ruby 2.3+, with concordant releases of JRuby and TruffleRuby.
CI workflows and Appraisals are generated for MRI Ruby 2.4+.
The current MRI CI lane runs on Linux and macOS.
The test floor is configured by ruby.test_minimum in .kettle-jem.yml.
When it is higher than the runtime floor, older runtime-compatible Rubies are
not covered by the generated CI or Appraisal matrix.
The amazing test matrix is powered by the kettle-dev stack.
| Gem | Source | Role | Total downloads |
|---|---|---|---|
| appraisal2 | GitHub | multi-dependency Appraisal matrix generation | |
| appraisal2-rubocop | GitHub | RuboCop Appraisal generator integration | |
| kettle-dev | GitHub | development, release, and CI workflow tooling | |
| kettle-jem | GitHub | Appraisals & CI workflow templates | |
| kettle-soup-cover | GitHub | SimpleCov coverage policy and reporting | |
| kettle-test | GitHub | standard test runner and coverage harness | |
| rubocop-lts | GitHub | Ruby-version-aware linting | |
| turbo_tests2 | GitHub | parallel test execution |
| Federated DVCS Repository | Status | Issues | PRs | Wiki | CI |
|---|---|---|---|---|---|
| ๐งช ruby-oauth/oauth on GitLab | The Truth | ๐ | ๐ | ๐ | ๐ญ Tiny Matrix |
| ๐ง ruby-oauth/oauth on CodeBerg | An Ethical Mirror (Donate) | ๐ | ๐ | โ | โญ๏ธ No Matrix |
| ๐ ruby-oauth/oauth on GitHub | Another Mirror | ๐ | ๐ | ๐ | ๐ฏ Full Matrix |
For enterprise support from the maintainer, use Upwork or CodeMentor.
Other support channels:
Install the gem and add to the applicationโs Gemfile by executing:
bundle add oauth
If bundler is not being used to manage dependencies, install the gem by executing:
gem install oauth
This is a ruby library which is intended to be used in creating Ruby Consumer and Service Provider applications. It is NOT a Rails plugin, but could easily be used for the foundation for such a Rails plugin.
The main client entry point is OAuth::Consumer.new(consumer_key, consumer_secret, options).
Common options include:
:site - Provider origin, for example https://provider.example.:request_token_path, :authorize_path, :authenticate_path, :access_token_path - Provider endpoint paths. Defaults are /oauth/request_token, /oauth/authorize, /oauth/authenticate, and /oauth/access_token.:request_token_url, :authorize_url, :access_token_url - Full endpoint URLs. Use these when endpoints are not all under the same :site origin.:scheme - Where OAuth parameters are sent: :header by default, or :body / :query_string.:http_method - HTTP method for token endpoint requests, :post by default.:signature_method - Signature method, HMAC-SHA1 by default.:body_hash_enabled - Whether request body hashes are signed where applicable. Defaults to true.:ca_file, :proxy, :debug_output - Net::HTTP transport options.:token_request_max_redirects - Maximum redirects followed while requesting OAuth tokens. Defaults to 10.:token_request_cross_origin_redirects - Whether token requests may follow redirects to a different scheme, host, or effective port. Defaults to false; only enable this when the providerโs token endpoints intentionally redirect across origins.:access_token_cross_origin_requests - Whether AccessToken service calls (#get/#post/#put/#patch/#delete/#head) may target an absolute URI whose origin (scheme, host, or effective port) differs from :site. Defaults to false; a cross-origin absolute URI raises OAuth::Error because it would send the signed OAuth Authorization header to a different host (credential leak / SSRF). Enable this only when you intentionally call signed service endpoints on other origins, and never pass untrusted/user-supplied URLs to these methods.This gem was originally extracted from @pelleโs oauth-plugin gem. After extraction that gem was made to depend on this gem.
Unfortunately, this gem does have some Rails related bits that are optional to load. You donโt need Rails! The Rails bits may be pulled out into a separate gem with the 1.x minor updates of this gem.
For browser-based three-legged OAuth 1.0a flows, pass an explicit
oauth_callback URL when requesting the request token. If you do not pass
oauth_callback, this gem defaults it to "oob" (out of band), which is
intended for command-line and non-HTTP clients.
callback_url = "http://127.0.0.1:3000/oauth/callback"
Create a new OAuth::Consumer instance by passing it a configuration hash:
oauth_consumer = OAuth::Consumer.new(
"consumer_key",
"consumer_secret",
site: "https://provider.example"
)
Start the process by requesting a token:
request_token = oauth_consumer.get_request_token(oauth_callback: callback_url)
session[:token] = request_token.token
session[:token_secret] = request_token.secret
redirect_to request_token.authorize_url
When the user returns to your callback URL, rebuild the request token from the
values you stored and exchange it for an access token. OAuth 1.0a providers
return oauth_verifier in the callback, and it must be included in this
exchange.
hash = {oauth_token: session[:token], oauth_token_secret: session[:token_secret]}
request_token = OAuth::RequestToken.from_hash(oauth_consumer, hash)
access_token = request_token.get_access_token(oauth_verifier: params[:oauth_verifier])
@photos = access_token.get("/photos.xml")
For OAuth 1.0 providers that do not use oauth_verifier, call
request_token.get_access_token without the verifier.
Now that you have an access token, you can use Typhoeus to interact with the OAuth provider if you choose.
require "typhoeus"
require "oauth/request_proxy/typhoeus_request"
uri = "https://provider.example/photos.xml"
options = {method: :get, headers: {}}
oauth_params = {consumer: oauth_consumer, token: access_token}
hydra = Typhoeus::Hydra.new
req = Typhoeus::Request.new(uri, options) # :method needs to be specified in options
oauth_helper = OAuth::Client::Helper.new(req, oauth_params.merge(request_uri: uri))
req.options[:headers] ||= {}
req.options[:headers]["Authorization"] = oauth_helper.header # Signs the request
hydra.queue(req)
hydra.run
@response = req.response
While ruby-oauth tools are free software and will always be, the project would benefit immensely from some funding. Raising a monthly budget ofโฆ โdollarsโ would make the project more sustainable.
We welcome both individual and corporate sponsors! We also offer a wide array of funding channels to account for your preferences. Currently, Open Collective is our preferred funding platform.
If youโre working in a company thatโs making significant use of ruby-oauth tools weโd appreciate it if you suggest to your company to become a ruby-oauth sponsor.
You can support the development of ruby-oauth tools via GitHub Sponsors, Liberapay, Open Collective, and PayPal.
Support us with a monthly donation and help us continue our activities. [Become a backer]
NOTE: kettle-readme-backers updates this list every day, automatically.
No backers yet. Be the first!
Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]
NOTE: kettle-readme-backers updates this list every day, automatically.
No sponsors yet. Be the first!
Bill Woika Philipp Ebneter Grigoriy Guest
Iโm driven by a passion to foster a thriving open-source community โ a space where people can tackle complex problems, no matter how small. Revitalizing libraries that have fallen into disrepair, and building new libraries focused on solving real-world challenges, are my passions. I was recently affected by layoffs, and the tech jobs market is unwelcoming. Iโm reaching out here because your support would significantly aid my efforts to provide for my family, and my farm (11 ๐ chickens, 2 ๐ถ dogs, 3 ๐ฐ rabbits, 8 ๐โ cats).
If you work at a company that uses my work, please encourage them to support me as a corporate sponsor. My work on gems you use might show up in bundle fund.
Iโm developing a new library, floss_funding, designed to empower open-source developers like myself to get paid for the work we do, in a sustainable way. Please give it a look.
Floss-Funding.dev: ๐๏ธ No network calls. ๐๏ธ No tracking. ๐๏ธ No oversight. ๐๏ธ Minimal crypto hashing. ๐ก Easily disabled nags
See SECURITY.md.
If you need some ideas of where to help, you could work on adding more code coverage, check issues or PRs, or use the gem and think about how it could be better.
We so if you make changes, remember to update it.
See CONTRIBUTING.md for more detailed instructions.
See CONTRIBUTING.md.
Everyone interacting with this projectโs codebases, issue trackers,
chat rooms and mailing lists agrees to follow the .
Made with contributors-img.
Also see GitLab Contributors: https://gitlab.com/ruby-oauth/oauth/-/graphs/main
This library follows for its public API where practical.
For most applications, prefer the Pessimistic Version Constraint with two digits of precision.
For example:
spec.add_dependency("oauth", "~> 1.0")
Dropping support for a platform can be a breaking change for affected users. If a release changes supported platforms, it should be called out clearly in the changelog and versioned with that impact in mind.
To get a better understanding of how SemVer is intended to work over a projectโs lifetime, read this article from the creator of SemVer:
See CHANGELOG.md for a list of releases.
The gem is available as open source under the terms of
the MIT .
See LICENSE.md for the official copyright notice.
Maintainers have teeth and need to pay their dentists. After getting laid off in an RIF in March, and encountering difficulty finding a new one, I began spending most of my time building open source tools. Iโm hoping to be able to pay for my kidsโ health insurance this month, so if you value the work I am doing, I need your support. Please consider sponsoring me or the project.
To join the community or get help, use the RubyForum or Discord.
To say โthanks!โ โ๏ธ Join the community or ๐๏ธ send money.
Many parts of this project are actively managed by a kettle-jem smart template utilizing StructuredMerge.org merge contracts.
Thanks for RTFM. โบ๏ธ
| Field | Value |
|โ|โ|
| Package | oauth |
| Description | ๐ A Ruby wrapper for the original OAuth 1.0 / 1.0a spec. |
| Homepage | https://github.com/ruby-oauth/oauth |
| Source | https://github.com/ruby-oauth/oauth |
| License | MIT |
| Funding | https://github.com/sponsors/pboling, https://ko-fi.com/pboling, https://liberapay.com/pboling/donate, https://opencollective.com/ruby-oauth, https://thanks.dev/u/gh/pboling, https://www.buymeacoffee.com/pboling |