Skip to content

googleapis/signet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c36d1cd · Mar 3, 2025
Mar 3, 2025
Feb 26, 2025
Aug 26, 2022
Mar 3, 2025
Feb 1, 2024
Sep 16, 2010
Jan 27, 2012
Apr 1, 2021
Feb 13, 2024
Mar 31, 2022
Mar 2, 2021
Nov 13, 2024
Sep 1, 2021
Feb 13, 2024
Jul 30, 2018
Mar 3, 2025
Oct 12, 2017
Mar 3, 2025
May 13, 2021
Apr 20, 2022
Mar 3, 2025

Signet

Homepage
https://github.com/googleapis/signet/
Author
Bob Aman
Copyright
Copyright © 2010 Google, Inc.
License
Apache 2.0

Gem Version

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 => "#{YOUR_CLIENT_ID}.apps.googleusercontent.com",
  :client_secret => YOUR_CLIENT_SECRET,
  :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 supported on Ruby 3.0+.

Google provides official support for Ruby versions that are actively supported by Ruby Core—that is, Ruby versions that are either in normal maintenance or in security maintenance, and not end of life. Older versions of Ruby may still work, but are unsupported and not recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby support schedule.