omniauth-twitter2 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9a5bf9460fa81e2e1400a60879f0f2c067aed70e32e76733195513a9d2741bf
4
- data.tar.gz: a74dcf8886af81af0005b972ce6eb349f63e40b3514b7cce02d4b330bb3b38db
3
+ metadata.gz: 75f14cedc7faaf00d30e11994f7d0a7d1ab62ce8a337165afe75f3274983d683
4
+ data.tar.gz: 21c3beb41bb76eaaa0ec558c5fe43d8973d4d23249e1934f786ec092aa0bbd0d
5
5
  SHA512:
6
- metadata.gz: 04b4f31d5af0fc0a9e2eb38402bf18619b506e6e8989622513f3334215fe0c7d27f5e643d74c7fd34bc2b2f9342f504e528ca3aab3bc2f75f7041c1410276162
7
- data.tar.gz: b87bb2d9a05795bcfd9f96f7fdef4daa9ee7c53738039f60d6372c7772dd1b1dec54239b1e03045ccaa2e97db418849801ff8707e83653d197e3e409cff46286
6
+ metadata.gz: 1bbb69083b4e90d6691d0aa545733a1a1c63fc6cf0152a621a031bf9b8812d307911f9399d15c8f9418e2fd1970ccbf888952496d1fac10b7a208da329945dd9
7
+ data.tar.gz: 740e6eeaa3c485d3853261eaec50949ee045ec937258947d38ae87a4d02bb8a7a47cc2373d6ec84a54907cb328684603e0f0c1945ba7b61dbf7a4b81f0dd83ed
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.2.0] - 2026-05-22
4
+
5
+ - fix: avoid requesting `confirmed_email` without `users.email` scope ([#17](https://github.com/unasuke/omniauth-twitter2/pull/17))
6
+ - chore: replace Twitter branding with X in documentation and gem metadata ([#16](https://github.com/unasuke/omniauth-twitter2/pull/16))
7
+ - chore: add release workflow for trusted publishing ([#19](https://github.com/unasuke/omniauth-twitter2/pull/19))
8
+ - chore: pin GitHub Actions by hash and switch dependabot to monthly schedule ([#18](https://github.com/unasuke/omniauth-twitter2/pull/18))
9
+ - chore: bump actions/checkout from 4 to 6 ([#15](https://github.com/unasuke/omniauth-twitter2/pull/15))
10
+ - chore: add Dependabot config for GitHub Actions updates ([#14](https://github.com/unasuke/omniauth-twitter2/pull/14))
11
+
3
12
  ## [1.1.0] - 2026-03-12
4
13
 
5
14
  - feat: add email support via confirmed_email field ([#10](https://github.com/unasuke/omniauth-twitter2/pull/10))
data/README.md CHANGED
@@ -4,11 +4,11 @@
4
4
  [![GitHub license](https://img.shields.io/github/license/unasuke/omniauth-twitter2)](https://github.com/unasuke/omniauth-twitter2/blob/main/LICENSE.txt)
5
5
  [![Gem Version](https://badge.fury.io/rb/omniauth-twitter2.svg)](https://rubygems.org/gems/omniauth-twitter2)
6
6
 
7
- This gem provides a OmniAuth strategy for authenticating with Twitter OAuth2.
7
+ This gem provides a OmniAuth strategy for authenticating with X (formerly known as Twitter) OAuth2.
8
8
 
9
9
  ## Email Support
10
10
 
11
- As of April 2025, Twitter/X API v2 supports returning the user's email address via the `confirmed_email` field. See the [X Developer Community announcement](https://devcommunity.x.com/t/introducing-confirmed-email-in-user-object/233461).
11
+ As of April 2025, X API v2 supports returning the user's email address via the `confirmed_email` field. See the [X Developer Community announcement](https://devcommunity.x.com/t/introducing-confirmed-email-in-user-object/233461).
12
12
 
13
13
  To request the email, include the `users.email` scope:
14
14
 
@@ -18,8 +18,8 @@ scope: "tweet.read users.read users.email"
18
18
 
19
19
  **Note:** The email will only be returned if:
20
20
 
21
- 1. Your Twitter app has "Request email from users" enabled in the Developer Portal
22
- 2. The user has a confirmed email address on their Twitter account
21
+ 1. Your X app has "Request email from users" enabled in the Developer Portal
22
+ 2. The user has a confirmed email address on their X account
23
23
  3. The user grants permission during OAuth
24
24
 
25
25
  If these conditions aren't met, `email` will be `nil` in the auth hash.
@@ -119,8 +119,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
119
119
 
120
120
  ## References
121
121
 
122
- * Twitter official resources
123
- * [xdevplatform/Twitter-API-v2-sample-code: Sample code for the Twitter API v2 endpoints](https://github.com/xdevplatform/Twitter-API-v2-sample-code)
122
+ * X official resources
123
+ * [xdevplatform/samples: Sample code for the X API v2 endpoints](https://github.com/xdevplatform/samples)
124
124
  * [OAuth 2.0 - X](https://docs.x.com/fundamentals/authentication/oauth-2-0/overview)
125
125
  * [arunagw/omniauth-twitter: OmniAuth strategy for Twitter](https://github.com/arunagw/omniauth-twitter)
126
126
  * [omniauth/omniauth-oauth2: An abstract OAuth2 strategy for OmniAuth.](https://github.com/omniauth/omniauth-oauth2)
@@ -38,8 +38,7 @@ module OmniAuth
38
38
  def raw_info
39
39
  @raw_info ||= access_token.get(
40
40
  "/2/users/me?" \
41
- "user.fields=confirmed_email,created_at,description,entities,id,location,name,pinned_tweet_id," \
42
- "profile_image_url,protected,public_metrics,url,username,verified,withheld",
41
+ "user.fields=#{build_user_fields_query}",
43
42
  { headers: { "Authorization" => "Bearer #{access_token.token}" } }
44
43
  ).parsed || {}
45
44
  end
@@ -59,6 +58,28 @@ module OmniAuth
59
58
  )
60
59
  super
61
60
  end
61
+
62
+ private
63
+
64
+ def build_user_fields_query
65
+ if users_email_required?
66
+ user_fields_query_base.push("confirmed_email")
67
+ else
68
+ user_fields_query_base
69
+ end
70
+ .join(",")
71
+ end
72
+
73
+ def user_fields_query_base
74
+ %w[
75
+ created_at description entities id location name pinned_tweet_id
76
+ profile_image_url protected public_metrics url username verified withheld
77
+ ]
78
+ end
79
+
80
+ def users_email_required?
81
+ options[:scope].split(/\s+/).include?("users.email")
82
+ end
62
83
  end
63
84
  end
64
85
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Twitter2
5
- VERSION = "1.1.0"
5
+ VERSION = "1.2.0"
6
6
  end
7
7
  end
@@ -8,8 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Yusuke Nakamura"]
9
9
  spec.email = ["yusuke1994525@gmail.com"]
10
10
 
11
- spec.summary = "Twitter OAuth2 strategy for OmniAuth"
12
- spec.description = "Twitter OAuth2 strategy for OmniAuth. '2' means OAuth 2.0."
11
+ spec.summary = "X (formerly known as Twitter) OAuth2 strategy for OmniAuth"
12
+ spec.description = "X (formerly known as Twitter) OAuth2 strategy for OmniAuth." \
13
+ "'2' means OAuth 2.0, not successor of omniauth-twitter gem."
13
14
  spec.homepage = "https://github.com/unasuke/omniauth-twitter2"
14
15
  spec.license = "Apache-2.0"
15
16
  spec.required_ruby_version = ">= 2.6.0"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-twitter2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Nakamura
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-03-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: omniauth
@@ -37,7 +37,8 @@ dependencies:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '1.0'
40
- description: Twitter OAuth2 strategy for OmniAuth. '2' means OAuth 2.0.
40
+ description: X (formerly known as Twitter) OAuth2 strategy for OmniAuth.'2' means
41
+ OAuth 2.0, not successor of omniauth-twitter gem.
41
42
  email:
42
43
  - yusuke1994525@gmail.com
43
44
  executables: []
@@ -81,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
82
  - !ruby/object:Gem::Version
82
83
  version: '0'
83
84
  requirements: []
84
- rubygems_version: 3.6.2
85
+ rubygems_version: 4.0.10
85
86
  specification_version: 4
86
- summary: Twitter OAuth2 strategy for OmniAuth
87
+ summary: X (formerly known as Twitter) OAuth2 strategy for OmniAuth
87
88
  test_files: []