New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

faraday_middleware-oauth2_refresh

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faraday_middleware-oauth2_refresh

0.1.3
Version published
Maintainers
1
Created

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

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-2021 by John Wang

FAQs

Package last updated on 15 Feb 2023

Did you know?

Socket

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.

Install

Related posts