Maintaining oauth2

A Ruby wrapper for the OAuth 2.0 protocol

Gem Version Total Downloads Downloads Today Network Stars Build Status Coverage Status Maintainability Depfu Open Source Helpers Chat License: MIT Documentation

UPDATE 2018-10-13: Version 1.4.1 has been released!

I am now the lead maintainer of the oauth2 gem. I will work toward getting a version 2.0.0 released, which will not drop support for any currently supported Rubies. After that a 3.0.0 release will drop support for EOL Rubies.

Oauth2 gem is looking for additional maintainers. See #307.

A Ruby wrapper for the OAuth 2.0 specification.

Installation

Add this line to your application’s Gemfile:

gem 'oauth2'

And then execute:

$ bundle

Or install it yourself as:

$ gem install oauth2

Resources

Usage Example

require 'oauth2'
client = OAuth2::Client.new('client_id', 'client_secret', :site => 'https://example.org')

client.auth_code.authorize_url(:redirect_uri => 'http://localhost:8080/oauth2/callback')
# => "https://example.org/oauth/authorization?response_type=code&client_id=client_id&redirect_uri=http://localhost:8080/oauth2/callback"

token = client.auth_code.get_token('authorization_code_value', :redirect_uri => 'http://localhost:8080/oauth2/callback', :headers => {'Authorization' => 'Basic some_password'})
response = token.get('/api/resource', :params => { 'query_foo' => 'bar' })
response.class.name
# => OAuth2::Response
comments powered by Disqus