• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

go-pkgz / auth / 44832171292
87%
master: 87%

Build:
Build:
LAST BUILD BRANCH: twitter-v2-oauth2
DEFAULT BRANCH: master
Ran 20 Nov 2026 10:52PM UTC
Jobs 1
Files 25
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

20 Nov 2026 10:44PM UTC coverage: 87.326% (+0.2%) from 87.082%
44832171292

Pull #332

github

paskal
Add an OAuth 2.0 provider for X (Twitter) to v2

Previously, the only way to sign in with X was the OAuth 1.0a `twitter`
provider, which reads the user from API v1.1. X's documentation
describes v1.1 as limited support and points new projects to v2.

After this change, v2 has `NewTwitterV2`, registered as
`AddProvider("twitter_v2", clientID, clientSecret)`. It uses the
authorization code flow with PKCE, authenticates at the token endpoint
with the Basic header only and reads the user from `GET /2/users/me`.
The provider name stays `twitter` and the user ID is derived from the
account ID as in `NewTwitter`, so the routes, the callback URL and the
user IDs are the same with either provider. `NewTwitter` is unchanged.

In v2, `Oauth2Handler.AuthHandler` now returns HTTP 503 without issuing
a session when any OAuth 2.0 or custom provider maps a user to an empty
ID. This prevents different users from sharing an empty identity.
`NewTwitterV2` returns an empty ID unless `data.id` is a non-empty
string; custom providers using `CustomHandlerOpt.MapUserFn` must also
return a non-empty ID.

The README Twitter section gets the current X console steps for both
providers.
Pull Request #332: Add an OAuth 2.0 provider for X (Twitter) to v2

41 of 41 new or added lines in 3 files covered. (100.0%)

3459 of 3961 relevant lines covered (87.33%)

11.71 hits per line

Jobs
ID Job ID Ran Files Coverage
1 44832171292.1 20 Nov 2026 10:52PM UTC 25
87.33
GitHub Action Run
Source Files on build 44832171292
  • Tree
  • List 25
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #332
  • PR Base - master (#44434780739)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc