Signet 是一个 OAuth 1.0/OAuth 2.0 实现。
Homepagehttps://github.com/googleapis/signet/ AuthorBob Aman CopyrightCopyright © 2010 Google, Inc. LicenseApache 2.0
Signet is an OAuth 1.0 / OAuth 2.0 implementation.
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'
)redirect_to(client.authorization_uri)client.code = request.query['code']
client.fetch_access_token!gem install signet
Be sure https://rubygems.org is in your gem sources.
This library is supported on Ruby 3.2+.
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.
暂无开放 Issues,或尚未同步最近议题。