Skip to content
Signet is an OAuth 1.0 / OAuth 2.0 implementation.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Update github issue templates (#122) Nov 28, 2018
.kokoro setup windows builds to track google-cloud-ruby (#136) Apr 4, 2019
lib fix audience documentation (#137) May 9, 2019
spec
website Reimporting project to play nice with git. Sep 16, 2010
yard Updating Signet to take advantage of wiki generation by YARD. Jan 27, 2012
.gitignore Drop whitespace. Sep 25, 2013
.rubocop.yml use build scripts from google-cloud-ruby (#135) Mar 22, 2019
CHANGELOG.md add constant time comparison for signatures (#119) Oct 10, 2018
CODE_OF_CONDUCT.md
Gemfile
LICENSE Update changelog for 0.8.0 release Oct 12, 2017
README.md warn on EOL ruby version (#110) Aug 29, 2018
Rakefile use build scripts from google-cloud-ruby (#135) Mar 22, 2019
signet.gemspec fix rubocop errors (#138) May 7, 2019

README.md

Signet

Homepage
http://code.google.com/p/oauth-signet/
Author
Bob Aman
Copyright
Copyright © 2010 Google, Inc.
License
Apache 2.0

Gem Version Build Status

Description

Signet is an OAuth 1.0 / OAuth 2.0 implementation.

Reference

  • {Signet::OAuth1}
  • {Signet::OAuth1::Client}
  • {Signet::OAuth1::Credential}
  • {Signet::OAuth1::Server}
  • {Signet::OAuth2}
  • {Signet::OAuth2::Client}

Example Usage for Google

Initialize the client

require 'signet/oauth_2/client'
client = Signet::OAuth2::Client.new(
  :authorization_uri => 'https://accounts.google.com/o/oauth2/auth',
  :token_credential_uri =>  'https://oauth2.googleapis.com/token',
  :client_id => '44410190108-74nkm6jc5e3vvjqis803frkvmu88cu3a.apps.googleusercontent.com',
  :client_secret => 'X1NUhvO-rQr9sm8uUSMY8i7v',
  :scope => 'email profile',
  :redirect_uri => 'https://example.client.com/oauth'
)

Request an authorization code

redirect_to(client.authorization_uri)

Obtain an access token

client.code = request.query['code']
client.fetch_access_token!

Install

gem install signet

Be sure https://rubygems.org is in your gem sources.

Supported Ruby Versions

This library is currently supported on Ruby 1.9+.
However, Ruby 2.4 or later is strongly recommended, as earlier releases have reached or are nearing end-of-life. After March 31, 2019, Google will provide official support only for Ruby versions that are considered current and supported by Ruby Core (that is, Ruby versions that are either in normal maintenance or in security maintenance). See https://www.ruby-lang.org/en/downloads/branches/ for further details.

You can’t perform that action at this time.