Git Product home page Git Product logo

faraday_middleware-oauth2_refresh's Introduction

FaradayMiddleware::OAuth2Refresh

Gem Version Build Status Coverage Status

Code Climate Scrutinizer Code Quality

Docs License

Faraday middleware to manage OAuth token authorization with token refresh.

Description

This gem is a piece of Faraday middleware that adds OAuth token handling using the oauth2 gem.

Installation

Add this line to your application's Gemfile:

gem 'faraday_middleware-oauth2_refresh'

And then execute:

$ bundle

Or install it yourself as:

$ gem install faraday_middleware-oauth2_refresh

Usage

require 'oauth2'
require 'faraday_middleware/oauth2_refresh'

client = OAuth2::Client.new('my_client_id', 'my_client_secret', site: 'https://example.com' )
token  = client.password.get_token('username', 'password', { headers: { 'Authorization' => 'Basic my_api_key' } })

conn = Faraday.new(url: "http://example.com") do |builder|
  builder.request :oauth2_refresh, token
  builder.adapter Faraday.default_adapter
end

conn.get "/foo" # sends token

Change Log

See CHANGELOG.md

Links

Project Repo

Problems, Comments, Suggestions, Contributions?

Any reports of problems, comments or suggestions are most welcome.

Please report these on Github

License

FaradayMiddleware::OAuth2Refresh is available under an MIT-style license. See {file:LICENSE.md} for details.

FaradayMiddleware::OAuth2Refresh © 2015-2023 by John Wang

faraday_middleware-oauth2_refresh's People

Contributors

codacy-badger avatar grokify avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

faraday_middleware-oauth2_refresh's Issues

Update Faraday

I'd love to use this, but the Faraday version is a major version behind - 1.2 vs 2.7. :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.