Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
OAuth 1.0 is an industry-standard protocol for authorization.
This is a RubyGem for implementing both OAuth 1.0 clients and servers in Ruby applications.
See the sibling oauth2
gem for OAuth 2.0 implementations in Ruby.
New EOL Policy
Versions 1.x will be EOL no later than April, 2025. Versions 0.6.x will be EOL no later than April, 2024. Versions 0.5.x will be EOL no later than April, 2023.
This will facilitate dropping support for old, dead, and crusty versions of Ruby.
Non-commercial support for the oldest version of Ruby (which itself is going EOL) will be dropped each year in April.
Please upgrade to version 1.1. The only breaking change in 1.x is dropping old Rubies.
Project | bundle add oauth | |
---|---|---|
1️⃣ | name, license, docs | |
2️⃣ | version & activity | |
3️⃣ | maintenance & linting | |
4️⃣ | testing | |
5️⃣ | coverage & security | |
6️⃣ | resources | |
7️⃣ | spread 💖 | 🌏 👼 💻 |
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
Available as part of the Tidelift Subscription.
The maintainers of OAuth2 and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. Learn more.
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.
For more see SECURITY.md.
Targeted ruby compatibility is non-EOL versions of Ruby, currently 2.7, 3.0, and 3.1. Ruby is limited to 2.7+ in the gemspec, and this will change with minor version bumps, while the gem is still in 0.x, in accordance with the SemVer spec.
The main
branch now targets 1.x releases, for Ruby >= 2.7.
See v0.6-maintenance
(EOL April, 2024) branch for Ruby >= 2.4.
See v0.5-maintenance
(EOL April, 2023) branch for Ruby >= 2.0.
NOTE: No further releases of version < 1.0.x are anticipated.
This gem is tested against MRI, and to a lesser extent, against JRuby, and Truffleruby. Each of those has varying versions that target a specific version of MRI Ruby. This gem should work in the just-listed Ruby engines according to the targeted MRI compatibility in the table below. If you would like to add support for additional engines, first make sure Github Actions supports the engine, then submit a PR to the correct maintenance branch as according to the table below.
If something doesn't work on one of these interpreters, it's a bug.
This library may inadvertently work (or seem to work) on other Ruby implementations, however support will only be provided for the versions listed above.
If you would like this library to support another Ruby version, you may volunteer to be a maintainer. Being a maintainer entails making sure all tests run and pass on that implementation. When something breaks on your implementation, you will be responsible for providing patches in a timely fashion. If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped.
Ruby OAuth Version | Maintenance Branch | EOL | 🚂 Compatibility | Official 💎 | Unofficial 💎 | Incidental 💎 | |
---|---|---|---|---|---|---|---|
1️⃣ | 1.0.x | main | Rails 6, 7 | 2.7, 3.0, 3.1 | sorry, not sorry | nope | |
2️⃣ | 0.6.x | v0.6-maintenance | 04/2024 | Rails 5, 6, 7 | 2.7, 3.0, 3.1 | 2.5, 2.6 | 2.4 |
3️⃣ | 0.5.x | v0.5-maintenance | 04/2023 | Rails 2, 3, 4, 5, 6, 7 | 2.7, 3.0, 3.1 | 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 | 2.0 |
4️⃣ | older | N/A | yesterday | Best of luck to you! | Please upgrade! | noop |
NOTE: Once 1.0 is released, the 0.x series will only receive critical bug and security updates. See SECURITY.md
🚂 NOTE: See notes on Rails in next section.
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.
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.
We need to specify the oauth_callback
url explicitly, otherwise it defaults to
"oob" (Out of Band)
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("key", "secret", site: "https://agree2")
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(oauth_callback: callback_url)
When user returns create an access_token
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
# For 3-legged authorization, flow oauth_verifier is passed as param in callback
# access_token = request_token.get_access_token(oauth_verifier: params[:oauth_verifier])
@photos = access_token.get("/photos.xml")
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"
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]["Authorization"] = oauth_helper.header # Signs the request
hydra.queue(req)
hydra.run
@response = req.response
See CONTRIBUTING.md
Made with contributors-img.
This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions. Compatibility with a major and minor versions of Ruby will only be changed with a major version bump.
As a result of this policy, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision.
For example:
spec.add_dependency "oauth", "~> 1.1"
The gem is available as open source under the terms of the MIT License . See LICENSE for the [Copyright Notice][copyright-notice-explainer].
OAuth Ruby has been created and maintained by a large number of talented individuals. The current maintainer is Peter Boling (@pboling).
Comments are welcome. Contact the OAuth Ruby mailing list (Google Group) or GitHub Discussions.
FAQs
Unknown package
We found that oauth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.