oauth2 2.0.13 → 2.0.15

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.
data/README.md CHANGED
@@ -1,23 +1,23 @@
1
1
  [![Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0][🖼️galtzo-i]][🖼️galtzo-discord] [![ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5][🖼️ruby-lang-i]][🖼️ruby-lang] [![oauth2 Logo by Chris Messina, CC BY-SA 3.0][🖼️oauth2-i]][🖼️oauth2]
2
2
 
3
- [🖼️oauth2-i]: https://logos.galtzo.com/assets/images/oauth/oauth2/avatar-192px.svg
4
- [🖼️oauth2]: https://github.com/ruby-oauth/oauth2
5
- [🖼️ruby-lang-i]: https://logos.galtzo.com/assets/images/ruby-lang/avatar-192px.svg
6
- [🖼️ruby-lang]: https://www.ruby-lang.org/
7
3
  [🖼️galtzo-i]: https://logos.galtzo.com/assets/images/galtzo-floss/avatar-192px.svg
8
4
  [🖼️galtzo-discord]: https://discord.gg/3qme4XHNKN
5
+ [🖼️ruby-lang-i]: https://logos.galtzo.com/assets/images/ruby-lang/avatar-192px.svg
6
+ [🖼️ruby-lang]: https://www.ruby-lang.org/
7
+ [🖼️oauth2-i]: https://logos.galtzo.com/assets/images/oauth/oauth2/avatar-192px.svg
8
+ [🖼️oauth2]: https://github.com/ruby-oauth/oauth2
9
9
 
10
10
  # 🔐 OAuth 2.0 Authorization Framework
11
11
 
12
12
  ⭐️ including OAuth 2.1 draft spec & OpenID Connect (OIDC)
13
13
 
14
- [![Version][👽versioni]][👽version] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license-ref] [![Downloads Rank][👽dl-ranki]][👽dl-rank] [![Open Source Helpers][👽oss-helpi]][👽oss-help] [![Coveralls Test Coverage][🔑coveralls-img]][🔑coveralls] [![QLTY Test Coverage][🔑qlty-covi]][🔑qlty-cov] [![QLTY Maintainability][🔑qlty-mnti]][🔑qlty-mnt] [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf] [![CI Runtime Dependencies @ HEAD][🚎12-crh-wfi]][🚎12-crh-wf] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Truffle Ruby][🚎9-t-wfi]][🚎9-t-wf] [![CI JRuby][🚎10-j-wfi]][🚎10-j-wf] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Supported][🚎6-s-wfi]][🚎6-s-wf] [![CI Legacy][🚎4-lg-wfi]][🚎4-lg-wf] [![CI Unsupported][🚎7-us-wfi]][🚎7-us-wf] [![CI Ancient][🚎1-an-wfi]][🚎1-an-wf] [![CI Caboose is an absolute WAGON][🚎13-cbs-wfi]][🚎13-cbs-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf] [![CodeQL][🖐codeQL-img]][🖐codeQL]
14
+ [![Version][👽versioni]][👽version] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license-ref] [![Downloads Rank][👽dl-ranki]][👽dl-rank] [![Open Source Helpers][👽oss-helpi]][👽oss-help] [![Coveralls Test Coverage][🔑coveralls-img]][🔑coveralls] [![QLTY Test Coverage][🔑qlty-covi]][🔑qlty-cov] [![QLTY Maintainability][🔑qlty-mnti]][🔑qlty-mnt] [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf] [![CI Runtime Dependencies @ HEAD][🚎12-crh-wfi]][🚎12-crh-wf] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Truffle Ruby][🚎9-t-wfi]][🚎9-t-wf] [![CI JRuby][🚎10-j-wfi]][🚎10-j-wf] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Supported][🚎6-s-wfi]][🚎6-s-wf] [![CI Legacy][🚎4-lg-wfi]][🚎4-lg-wf] [![CI Unsupported][🚎7-us-wfi]][🚎7-us-wf] [![CI Ancient][🚎1-an-wfi]][🚎1-an-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf] [![CodeQL][🖐codeQL-img]][🖐codeQL]
15
15
 
16
- If ☝️ `ci_badges.map(&:color).detect { it != "green"}` [let me know][🖼️galtzo-discord], as I may have missed the [discord notification][🖼️galtzo-discord].
16
+ `if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know][🖼️galtzo-discord], as I may have missed the [discord notification][🖼️galtzo-discord].
17
17
 
18
18
  ---
19
19
 
20
- OTOH, if `ci_badges.map(&:color).all? { it == "green"}` 👇️ send money so I can do more of this. FLOSS maintenance is now my full-time job.
20
+ `if ci_badges.map(&:color).all? { it == "green"}` 👇️ send money so I can do more of this. FLOSS maintenance is now my full-time job.
21
21
 
22
22
  [![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate on Polar][🖇polar-img]][🖇polar] [![Donate to my FLOSS or refugee efforts at ko-fi.com][🖇kofi-img]][🖇kofi] [![Donate to my FLOSS or refugee efforts using Patreon][🖇patreon-img]][🖇patreon]
23
23
 
@@ -61,32 +61,41 @@ NOTE: `header` - The content type specified in the `curl` is already the default
61
61
 
62
62
  </details>
63
63
 
64
- ### Upgrading Runtime Gem Dependencies
65
-
66
- This project sits underneath a large portion of the authorization systems on the internet.
67
- According to GitHub's project tracking, which I believe only reports on public projects,
68
- [100,000+ projects](https://github.com/ruby-oauth/oauth2/network/dependents), and
69
- [500+ packages](https://github.com/ruby-oauth/oauth2/network/dependents?dependent_type=PACKAGE) depend on this project.
64
+ If it seems like you are in the wrong place, you might try one of these:
70
65
 
71
- That means it is painful for the Ruby community when this gem forces updates to its runtime dependencies.
66
+ * [OAuth 2.0 Spec][oauth2-spec]
67
+ * [doorkeeper gem][doorkeeper-gem] for OAuth 2.0 server/provider implementation.
68
+ * [oauth sibling gem][sibling-gem] for OAuth 1.0a implementations in Ruby.
72
69
 
73
- As a result, great care, and a lot of time, have been invested to ensure this gem is working with all the
74
- leading versions per each minor version of Ruby of all the runtime dependencies it can install with.
70
+ [oauth2-spec]: https://oauth.net/2/
71
+ [sibling-gem]: https://gitlab.com/ruby-oauth/oauth
72
+ [doorkeeper-gem]: https://github.com/doorkeeper-gem/doorkeeper
75
73
 
76
- What does that mean specifically for the runtime dependencies?
74
+ ## 💡 Info you can shake a stick at
77
75
 
78
- We have 100% test coverage of lines and branches, and this test suite runs across a large matrix
79
- covering the latest patch for each of the following minor versions:
76
+ | Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
77
+ |-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
78
+ | Works with JRuby | ![JRuby 9.1 Compat][💎jruby-9.1i] ![JRuby 9.2 Compat][💎jruby-9.2i] ![JRuby 9.3 Compat][💎jruby-9.3i] <br/> [![JRuby 9.4 Compat][💎jruby-9.4i]][🚎10-j-wf] [![JRuby 10.0 Compat][💎jruby-c-i]][🚎11-c-wf] [![JRuby HEAD Compat][💎jruby-headi]][🚎3-hd-wf] |
79
+ | Works with Truffle Ruby | ![Truffle Ruby 22.3 Compat][💎truby-22.3i] ![Truffle Ruby 23.0 Compat][💎truby-23.0i] <br/> [![Truffle Ruby 23.1 Compat][💎truby-23.1i]][🚎9-t-wf] [![Truffle Ruby 24.1 Compat][💎truby-c-i]][🚎11-c-wf] |
80
+ | Works with MRI Ruby 3 | [![Ruby 3.0 Compat][💎ruby-3.0i]][🚎4-lg-wf] [![Ruby 3.1 Compat][💎ruby-3.1i]][🚎6-s-wf] [![Ruby 3.2 Compat][💎ruby-3.2i]][🚎6-s-wf] [![Ruby 3.3 Compat][💎ruby-3.3i]][🚎6-s-wf] [![Ruby 3.4 Compat][💎ruby-c-i]][🚎11-c-wf] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf] |
81
+ | Works with MRI Ruby 2 | ![Ruby 2.2 Compat][💎ruby-2.2i] <br/> [![Ruby 2.3 Compat][💎ruby-2.3i]][🚎13-cbs-wf] [![Ruby 2.4 Compat][💎ruby-2.4i]][🚎1-an-wf] [![Ruby 2.5 Compat][💎ruby-2.5i]][🚎1-an-wf] [![Ruby 2.6 Compat][💎ruby-2.6i]][🚎7-us-wf] [![Ruby 2.7 Compat][💎ruby-2.7i]][🚎7-us-wf] |
82
+ | Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on Github.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc] |
83
+ | Documentation | [![Discussion][⛳gg-discussions-img]][⛳gg-discussions] [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head] [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog] [![Wiki][📜wiki-img]][📜wiki] |
84
+ | Compliance | [![License: MIT][📄license-img]][📄license-ref] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |
85
+ | Style | [![Enforced Code Style Linter][💎rlts-img]][💎rlts] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] [![Gitmoji Commits][📌gitmoji-img]][📌gitmoji] [![Compatibility appraised by: appraisal2][💎appraisal2-img]][💎appraisal2] |
86
+ | Support | [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork] [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor] |
87
+ | Maintainer 🎖️ | [![Follow Me on LinkedIn][💖🖇linkedin-img]][💖🖇linkedin] [![Follow Me on Ruby.Social][💖🐘ruby-mast-img]][💖🐘ruby-mast] [![Follow Me on Bluesky][💖🦋bluesky-img]][💖🦋bluesky] [![Contact Maintainer][🚂maint-contact-img]][🚂maint-contact] [![My technical writing][💖💁🏼‍♂️devto-img]][💖💁🏼‍♂️devto] |
88
+ | `...` 💖 | [![Find Me on WellFound:][💖✌️wellfound-img]][💖✌️wellfound] [![Find Me on CrunchBase][💖💲crunchbase-img]][💖💲crunchbase] [![My LinkTree][💖🌳linktree-img]][💖🌳linktree] [![More About Me][💖💁🏼‍♂️aboutme-img]][💖💁🏼‍♂️aboutme] [🧊][💖🧊berg] [🐙][💖🐙hub] [🛖][💖🛖hut] [🧪][💖🧪lab] |
80
89
 
81
- | 🚚 _Amazing_ test matrix was brought to you by | 🔎 appraisal2 🔎 |
82
- |------------------------------------------------|--------------------------------------------------------------------------------------|
83
- | 👟 Check it out! | ✨ [github.com/appraisal-rb/appraisal2](https://github.com/appraisal-rb/appraisal2) ✨ |
90
+ ### Compatibility
84
91
 
85
92
  * Operating Systems: Linux, MacOS, Windows
86
93
  * MRI Ruby @ v2.3, v2.4, v2.5, v2.6, v2.7, v3.0, v3.1, v3.2, v3.3, v3.4, HEAD
87
- * NOTE: This gem will still install on ruby v2.2, but vanilla GitHub Actions no longer supports testing against it, so YMMV.
88
- * JRuby @ v9.2, v9.3, v9.4, v10.0, HEAD
94
+ * NOTE: This gem may still _install_ and _run_ on ruby v2.2, but vanilla GitHub Actions no longer supports testing against it, so YMMV. Accept patches so long as they don't break the platforms that do run in CI.
95
+ * JRuby @ v9.4, v10.0, HEAD
96
+ * NOTE: This gem may still _install_ and _run_ on JRuby v9.2 and v9.3, but they are EOL, builds are flaky, and GitHub Actions [doesn't have][GHA-continue-on-error-ui] a proper [`allow-failures` feature][GHA-allow-failure], and until they do flaky EOL-platform builds get dropped, so YMMV. Accept patches so long as they don't break the platforms that do run in CI.
89
97
  * TruffleRuby @ v23.1, v24.1, HEAD
98
+ * NOTE: This gem may still _install_ and _run_ on Truffleruby v22.3 and v23.0, but they are EOL, builds are flaky, and GitHub Actions [doesn't have][GHA-continue-on-error-ui] a proper [`allow-failures` feature][GHA-allow-failure], and until they do flaky EOL-platform builds get dropped, so YMMV. Accept patches so long as they don't break the platforms that do run in CI.
90
99
  * gem `faraday` @ v0, v1, v2, HEAD ⏩️ [lostisland/faraday](https://github.com/lostisland/faraday)
91
100
  * gem `jwt` @ v1, v2, v3, HEAD ⏩️ [jwt/ruby-jwt](https://github.com/jwt/ruby-jwt)
92
101
  * gem `logger` @ v1.2, v1.5, v1.7, HEAD ⏩️ [ruby/logger](https://github.com/ruby/logger)
@@ -102,15 +111,39 @@ Also, where reasonable, tested against the runtime dependencies of those depende
102
111
 
103
112
  * gem `hashie` @ v0, v1, v2, v3, v4, v5, HEAD ⏩️ [hashie/hashie](https://github.com/hashie/hashie)
104
113
 
114
+ [GHA-continue-on-error-ui]: https://github.com/actions/runner/issues/2347#issuecomment-2653479732
115
+ [GHA-allow-failure]: https://github.com/orgs/community/discussions/15452
116
+
117
+ #### Upgrading Runtime Gem Dependencies
118
+
119
+ This project sits underneath a large portion of the authorization systems on the internet.
120
+ According to GitHub's project tracking, which I believe only reports on public projects,
121
+ [100,000+ projects](https://github.com/ruby-oauth/oauth2/network/dependents), and
122
+ [500+ packages](https://github.com/ruby-oauth/oauth2/network/dependents?dependent_type=PACKAGE) depend on this project.
123
+
124
+ That means it is painful for the Ruby community when this gem forces updates to its runtime dependencies.
125
+
126
+ As a result, great care, and a lot of time, have been invested to ensure this gem is working with all the
127
+ leading versions per each minor version of Ruby of all the runtime dependencies it can install with.
128
+
129
+ What does that mean specifically for the runtime dependencies?
130
+
131
+ We have 100% test coverage of lines and branches, and this test suite runs across a very large matrix.
132
+ It wouldn't be possible without appraisal2.
133
+
134
+ | 🚚 _Amazing_ test matrix was brought to you by | 🔎 appraisal2 🔎 and the color 💚 green 💚 |
135
+ |------------------------------------------------|--------------------------------------------------------|
136
+ | 👟 Check it out! | ✨ [github.com/appraisal-rb/appraisal2][💎appraisal2] ✨ |
137
+
105
138
  #### You should upgrade this gem with confidence\*.
106
139
 
107
140
  - This gem follows a _strict & correct_ (according to the maintainer of SemVer; [more info][sv-pub-api]) interpretation of SemVer.
108
- - Dropping support for **any** of the runtime dependency versions above will be a major version bump.
109
- - If you aren't on one of the minor versions above, make getting there a priority.
141
+ - Dropping support for **any** of the runtime dependency versions above will be a major version bump.
142
+ - If you aren't on one of the minor versions above, make getting there a priority.
110
143
  - You should upgrade the dependencies of this gem with confidence\*.
111
144
  - Please do upgrade, and then, when it goes smooth as butter [please sponsor me][🖇sponsor]. Thanks!
112
145
 
113
- [sv-pub-api]: #-is-platform-support-part-of-the-public-api
146
+ [sv-pub-api]: #-versioning
114
147
 
115
148
  \* MIT license; The only guarantees I make are for [enterprise support](#enterprise-support).
116
149
 
@@ -129,52 +162,18 @@ If you use a gem version of a core Ruby library it should work fine!
129
162
 
130
163
  </details>
131
164
 
132
- If it seems like you are in the wrong place, you might try one of these:
133
-
134
- * [OAuth 2.0 Spec][oauth2-spec]
135
- * [doorkeeper gem][doorkeeper-gem] for OAuth 2.0 server/provider implementation.
136
- * [oauth sibling gem][sibling-gem] for OAuth 1.0 implementations in Ruby.
137
-
138
- [oauth2-spec]: https://oauth.net/2/
139
- [sibling-gem]: https://gitlab.com/ruby-oauth/oauth
140
- [doorkeeper-gem]: https://github.com/doorkeeper-gem/doorkeeper
141
-
142
- ## 💡 Info you can shake a stick at
143
-
144
- | Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
145
- |-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
146
- | Works with JRuby | ![JRuby 9.1 Compat][💎jruby-9.1i] ![JRuby 9.2 Compat][💎jruby-9.2i] ![JRuby 9.3 Compat][💎jruby-9.3i] <br/> [![JRuby 9.4 Compat][💎jruby-9.4i]][🚎10-j-wf] [![JRuby 10.0 Compat][💎jruby-c-i]][🚎11-c-wf] [![JRuby HEAD Compat][💎jruby-headi]][🚎3-hd-wf] |
147
- | Works with Truffle Ruby | ![Truffle Ruby 22.3 Compat][💎truby-22.3i] ![Truffle Ruby 23.0 Compat][💎truby-23.0i] <br/> [![Truffle Ruby 23.1 Compat][💎truby-23.1i]][🚎9-t-wf] [![Truffle Ruby 24.1 Compat][💎truby-c-i]][🚎11-c-wf] |
148
- | Works with MRI Ruby 3 | [![Ruby 3.0 Compat][💎ruby-3.0i]][🚎4-lg-wf] [![Ruby 3.1 Compat][💎ruby-3.1i]][🚎6-s-wf] [![Ruby 3.2 Compat][💎ruby-3.2i]][🚎6-s-wf] [![Ruby 3.3 Compat][💎ruby-3.3i]][🚎6-s-wf] [![Ruby 3.4 Compat][💎ruby-c-i]][🚎11-c-wf] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf] |
149
- | Works with MRI Ruby 2 | ![Ruby 2.2 Compat][💎ruby-2.2i] <br/> [![Ruby 2.3 Compat][💎ruby-2.3i]][🚎1-an-wf] [![Ruby 2.4 Compat][💎ruby-2.4i]][🚎1-an-wf] [![Ruby 2.5 Compat][💎ruby-2.5i]][🚎1-an-wf] [![Ruby 2.6 Compat][💎ruby-2.6i]][🚎7-us-wf] [![Ruby 2.7 Compat][💎ruby-2.7i]][🚎7-us-wf] |
150
- | Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on Github.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc] |
151
- | Documentation | [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head] [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog] [![Wiki][📜wiki-img]][📜wiki] |
152
- | Compliance | [![License: MIT][📄license-img]][📄license-ref] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |
153
- | Style | [![Enforced Code Style Linter][💎rlts-img]][💎rlts] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] [![Gitmoji Commits][📌gitmoji-img]][📌gitmoji] [![Compatibility appraised by: appraisal2][💎appraisal2-img]][💎appraisal2] |
154
- | Support | [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork] [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor] |
155
- | Maintainer 🎖️ | [![Follow Me on LinkedIn][💖🖇linkedin-img]][💖🖇linkedin] [![Follow Me on Ruby.Social][💖🐘ruby-mast-img]][💖🐘ruby-mast] [![Follow Me on Bluesky][💖🦋bluesky-img]][💖🦋bluesky] [![Contact Maintainer][🚂maint-contact-img]][🚂maint-contact] [![My technical writing][💖💁🏼‍♂️devto-img]][💖💁🏼‍♂️devto] |
156
- | `...` 💖 | [![Find Me on WellFound:][💖✌️wellfound-img]][💖✌️wellfound] [![Find Me on CrunchBase][💖💲crunchbase-img]][💖💲crunchbase] [![My LinkTree][💖🌳linktree-img]][💖🌳linktree] [![More About Me][💖💁🏼‍♂️aboutme-img]][💖💁🏼‍♂️aboutme] [🧊][💖🧊berg] [🐙][💖🐙hub] [🛖][💖🛖hut] [🧪][💖🧪lab] |
157
-
158
- ### Compatibility
159
-
160
- Compatible with Ruby 2.3+, and concordant releases of JRuby, and TruffleRuby.
161
-
162
- | 🚚 _Amazing_ test matrix was brought to you by | 🔎 appraisal2 🔎 |
163
- |------------------------------------------------|-------------------------------------------------------------------------------------|
164
- | 👟 Check it out! | ✨ [github.com/appraisal-rb/appraisal2][💎appraisal2] ✨ |
165
-
166
165
  ### Federated DVCS
167
166
 
168
167
  <details>
169
- <summary>Find this repo on other forges (Coming soon!)</summary>
168
+ <summary>Find this repo on other forges</summary>
170
169
 
171
- | Federated [DVCS][💎d-in-dvcs] Repository | Status | Issues | PRs | Wiki | CI | Discussions |
172
- |-------------------------------------------------|-----------------------------------------------------------------------|---------------------------|--------------------------|---------------------------|--------------------------|------------------------------|
173
- | 🧪 [ruby-oauth/oauth2 on GitLab][📜src-gl] | The Truth | [💚][🤝gl-issues] | [💚][🤝gl-pulls] | [💚][📜wiki] | 🏀 Tiny Matrix | ➖ |
174
- | 🧊 [ruby-oauth/oauth2 on CodeBerg][📜src-cb] | An Ethical Mirror ([Donate][🤝cb-donate]) | [💚][🤝cb-issues] | [💚][🤝cb-pulls] | ➖ | ⭕️ No Matrix | ➖ |
175
- | 🐙 [ruby-oauth/oauth2 on GitHub][📜src-gh] | Another Mirror | [💚][🤝gh-issues] | [💚][🤝gh-pulls] | ➖ | 💯 Full Matrix | [💚][gh-discussions] |
176
- | 🤼 [OAuth Ruby Google Group][⛳gg-discussions] | "Active" | ➖ | ➖ | ➖ | ➖ | [💚][⛳gg-discussions] |
177
- | 🎮️ [Discord Server][✉️discord-invite] | [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] | [Let's][✉️discord-invite] | [talk][✉️discord-invite] | [about][✉️discord-invite] | [this][✉️discord-invite] | [library!][✉️discord-invite] |
170
+ | Federated [DVCS][💎d-in-dvcs] Repository | Status | Issues | PRs | Wiki | CI | Discussions |
171
+ |-----------------------------------------------|-----------------------------------------------------------------------|---------------------------|--------------------------|---------------------------|--------------------------|------------------------------|
172
+ | 🧪 [ruby-oauth/oauth2 on GitLab][📜src-gl] | The Truth | [💚][🤝gl-issues] | [💚][🤝gl-pulls] | [💚][📜wiki] | 🏀 Tiny Matrix | ➖ |
173
+ | 🧊 [ruby-oauth/oauth2 on CodeBerg][📜src-cb] | An Ethical Mirror ([Donate][🤝cb-donate]) | [💚][🤝cb-issues] | [💚][🤝cb-pulls] | ➖ | ⭕️ No Matrix | ➖ |
174
+ | 🐙 [ruby-oauth/oauth2 on GitHub][📜src-gh] | Another Mirror | [💚][🤝gh-issues] | [💚][🤝gh-pulls] | ➖ | 💯 Full Matrix | [💚][gh-discussions] |
175
+ | 🤼 [OAuth Ruby Google Group][⛳gg-discussions] | "Active" | ➖ | ➖ | ➖ | ➖ | [💚][⛳gg-discussions] |
176
+ | 🎮️ [Discord Server][✉️discord-invite] | [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] | [Let's][✉️discord-invite] | [talk][✉️discord-invite] | [about][✉️discord-invite] | [this][✉️discord-invite] | [library!][✉️discord-invite] |
178
177
 
179
178
  </details>
180
179
 
@@ -182,9 +181,13 @@ Compatible with Ruby 2.3+, and concordant releases of JRuby, and TruffleRuby.
182
181
 
183
182
  ### Enterprise Support [![Tidelift](https://tidelift.com/badges/package/rubygems/oauth2)](https://tidelift.com/subscription/pkg/rubygems-oauth2?utm_source=rubygems-oauth2&utm_medium=referral&utm_campaign=readme)
184
183
 
184
+ Available as part of the Tidelift Subscription.
185
+
185
186
  <details>
186
187
  <summary>Need enterprise-level guarantees?</summary>
187
188
 
189
+ The maintainers of this and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
190
+
188
191
  [![Get help from me on Tidelift][🏙️entsup-tidelift-img]][🏙️entsup-tidelift]
189
192
 
190
193
  - 💡Subscribe for support guarantees covering _all_ your FLOSS dependencies
@@ -199,6 +202,131 @@ Alternatively:
199
202
 
200
203
  </details>
201
204
 
205
+ ## 🚀 Release Documentation
206
+
207
+ ### Version 2.0.x
208
+
209
+ <details>
210
+ <summary>2.0.x CHANGELOG and README</summary>
211
+
212
+ | Version | Release Date | CHANGELOG | README |
213
+ |---------|--------------|---------------------------------------|---------------------------------|
214
+ | 2.0.13 | 2025-08-30 | [v2.0.13 CHANGELOG][2.0.13-changelog] | [v2.0.13 README][2.0.13-readme] |
215
+ | 2.0.12 | 2025-05-31 | [v2.0.12 CHANGELOG][2.0.12-changelog] | [v2.0.12 README][2.0.12-readme] |
216
+ | 2.0.11 | 2025-05-23 | [v2.0.11 CHANGELOG][2.0.11-changelog] | [v2.0.11 README][2.0.11-readme] |
217
+ | 2.0.10 | 2025-05-17 | [v2.0.10 CHANGELOG][2.0.10-changelog] | [v2.0.10 README][2.0.10-readme] |
218
+ | 2.0.9 | 2022-09-16 | [v2.0.9 CHANGELOG][2.0.9-changelog] | [v2.0.9 README][2.0.9-readme] |
219
+ | 2.0.8 | 2022-09-01 | [v2.0.8 CHANGELOG][2.0.8-changelog] | [v2.0.8 README][2.0.8-readme] |
220
+ | 2.0.7 | 2022-08-22 | [v2.0.7 CHANGELOG][2.0.7-changelog] | [v2.0.7 README][2.0.7-readme] |
221
+ | 2.0.6 | 2022-07-13 | [v2.0.6 CHANGELOG][2.0.6-changelog] | [v2.0.6 README][2.0.6-readme] |
222
+ | 2.0.5 | 2022-07-07 | [v2.0.5 CHANGELOG][2.0.5-changelog] | [v2.0.5 README][2.0.5-readme] |
223
+ | 2.0.4 | 2022-07-01 | [v2.0.4 CHANGELOG][2.0.4-changelog] | [v2.0.4 README][2.0.4-readme] |
224
+ | 2.0.3 | 2022-06-28 | [v2.0.3 CHANGELOG][2.0.3-changelog] | [v2.0.3 README][2.0.3-readme] |
225
+ | 2.0.2 | 2022-06-24 | [v2.0.2 CHANGELOG][2.0.2-changelog] | [v2.0.2 README][2.0.2-readme] |
226
+ | 2.0.1 | 2022-06-22 | [v2.0.1 CHANGELOG][2.0.1-changelog] | [v2.0.1 README][2.0.1-readme] |
227
+ | 2.0.0 | 2022-06-21 | [v2.0.0 CHANGELOG][2.0.0-changelog] | [v2.0.0 README][2.0.0-readme] |
228
+
229
+ </details>
230
+
231
+ [2.0.13-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#2013---2025-08-30
232
+ [2.0.12-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#2012---2025-05-31
233
+ [2.0.11-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#2011---2025-05-23
234
+ [2.0.10-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#2010---2025-05-17
235
+ [2.0.9-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#209---2022-09-16
236
+ [2.0.8-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#208---2022-09-01
237
+ [2.0.7-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#207---2022-08-22
238
+ [2.0.6-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#206---2022-07-13
239
+ [2.0.5-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#205---2022-07-07
240
+ [2.0.4-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#204---2022-07-01
241
+ [2.0.3-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#203---2022-06-28
242
+ [2.0.2-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#202---2022-06-24
243
+ [2.0.1-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#201---2022-06-22
244
+ [2.0.0-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#200---2022-06-21
245
+
246
+ [2.0.13-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.13/README.md
247
+ [2.0.12-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.12/README.md
248
+ [2.0.11-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.11/README.md
249
+ [2.0.10-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.10/README.md
250
+ [2.0.9-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.9/README.md
251
+ [2.0.8-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.8/README.md
252
+ [2.0.7-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.7/README.md
253
+ [2.0.6-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.6/README.md
254
+ [2.0.5-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.5/README.md
255
+ [2.0.4-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.4/README.md
256
+ [2.0.3-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.3/README.md
257
+ [2.0.2-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.2/README.md
258
+ [2.0.1-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.1/README.md
259
+ [2.0.0-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v2.0.0/README.md
260
+
261
+ ### Older Releases
262
+
263
+ <details>
264
+ <summary>1.4.x CHANGELOGs and READMEs</summary>
265
+
266
+ | Version | Release Date | CHANGELOG | README |
267
+ |---------|--------------|---------------------------------------|---------------------------------|
268
+ | 1.4.11 | Sep 16, 2022 | [v1.4.11 CHANGELOG][1.4.11-changelog] | [v1.4.11 README][1.4.11-readme] |
269
+ | 1.4.10 | Jul 1, 2022 | [v1.4.10 CHANGELOG][1.4.10-changelog] | [v1.4.10 README][1.4.10-readme] |
270
+ | 1.4.9 | Feb 20, 2022 | [v1.4.9 CHANGELOG][1.4.9-changelog] | [v1.4.9 README][1.4.9-readme] |
271
+ | 1.4.8 | Feb 18, 2022 | [v1.4.8 CHANGELOG][1.4.8-changelog] | [v1.4.8 README][1.4.8-readme] |
272
+ | 1.4.7 | Mar 19, 2021 | [v1.4.7 CHANGELOG][1.4.7-changelog] | [v1.4.7 README][1.4.7-readme] |
273
+ | 1.4.6 | Mar 19, 2021 | [v1.4.6 CHANGELOG][1.4.6-changelog] | [v1.4.6 README][1.4.6-readme] |
274
+ | 1.4.5 | Mar 18, 2021 | [v1.4.5 CHANGELOG][1.4.5-changelog] | [v1.4.5 README][1.4.5-readme] |
275
+ | 1.4.4 | Feb 12, 2020 | [v1.4.4 CHANGELOG][1.4.4-changelog] | [v1.4.4 README][1.4.4-readme] |
276
+ | 1.4.3 | Jan 29, 2020 | [v1.4.3 CHANGELOG][1.4.3-changelog] | [v1.4.3 README][1.4.3-readme] |
277
+ | 1.4.2 | Oct 1, 2019 | [v1.4.2 CHANGELOG][1.4.2-changelog] | [v1.4.2 README][1.4.2-readme] |
278
+ | 1.4.1 | Oct 13, 2018 | [v1.4.1 CHANGELOG][1.4.1-changelog] | [v1.4.1 README][1.4.1-readme] |
279
+ | 1.4.0 | Jun 9, 2017 | [v1.4.0 CHANGELOG][1.4.0-changelog] | [v1.4.0 README][1.4.0-readme] |
280
+ </details>
281
+
282
+ [1.4.11-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#1411---2022-09-16
283
+ [1.4.10-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#1410---2022-07-01
284
+ [1.4.9-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#149---2022-02-20
285
+ [1.4.8-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#148---2022-02-18
286
+ [1.4.7-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#147---2021-03-19
287
+ [1.4.6-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#146---2021-03-19
288
+ [1.4.5-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#145---2021-03-18
289
+ [1.4.4-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#144---2020-02-12
290
+ [1.4.3-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#143---2020-01-29
291
+ [1.4.2-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#142---2019-10-01
292
+ [1.4.1-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#141---2018-10-13
293
+ [1.4.0-changelog]: https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md?ref_type=heads#140---2017-06-09
294
+
295
+ [1.4.11-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.11/README.md
296
+ [1.4.10-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.10/README.md
297
+ [1.4.9-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.9/README.md
298
+ [1.4.8-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.8/README.md
299
+ [1.4.7-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.7/README.md
300
+ [1.4.6-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.6/README.md
301
+ [1.4.5-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.5/README.md
302
+ [1.4.4-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.4/README.md
303
+ [1.4.3-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.3/README.md
304
+ [1.4.2-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.2/README.md
305
+ [1.4.1-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.1/README.md
306
+ [1.4.0-readme]: https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.4.0/README.md
307
+
308
+ <details>
309
+ <summary>1.3.x Readmes</summary>
310
+
311
+ | Version | Release Date | Readme |
312
+ |---------|--------------|--------------------------------------------------------------|
313
+ | 1.3.1 | Mar 3, 2017 | https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.3.1/README.md |
314
+ | 1.3.0 | Dec 27, 2016 | https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.3.0/README.md |
315
+
316
+ </details>
317
+
318
+ <details>
319
+ <summary>&le;= 1.2.x Readmes (2016 and before)</summary>
320
+
321
+ | Version | Release Date | Readme |
322
+ |---------|--------------|--------------------------------------------------------------|
323
+ | 1.2.0 | Jun 30, 2016 | https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.2.0/README.md |
324
+ | 1.1.0 | Jan 30, 2016 | https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.1.0/README.md |
325
+ | 1.0.0 | May 23, 2014 | https://gitlab.com/ruby-oauth/oauth2/-/blob/v1.0.0/README.md |
326
+ | < 1.0.0 | Find here | https://gitlab.com/ruby-oauth/oauth2/-/tags |
327
+
328
+ </details>
329
+
202
330
  ## ✨ Installation
203
331
 
204
332
  Install the gem and add to the application's Gemfile by executing:
@@ -248,21 +376,6 @@ NOTE: Be prepared to track down certs for signed gems and add them the same way
248
376
 
249
377
  </details>
250
378
 
251
- ## OAuth2 for Enterprise
252
-
253
- Available as part of the Tidelift Subscription.
254
-
255
- The maintainers of this and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.][tidelift-ref]
256
-
257
- [tidelift-ref]: https://tidelift.com/subscription/pkg/rubygems-oauth2?utm_source=rubygems-oauth2&utm_medium=referral&utm_campaign=enterprise
258
-
259
- ## Security contact information
260
-
261
- To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
262
- Tidelift will coordinate the fix and disclosure.
263
-
264
- For more see [SECURITY.md][🔐security].
265
-
266
379
  ## What is new for v2.0?
267
380
 
268
381
  - Works with Ruby versions >= 2.2
@@ -515,7 +628,7 @@ end
515
628
 
516
629
  See [response_spec.rb](https://github.com/ruby-oauth/oauth2/blob/main/spec/oauth2/response_spec.rb), or the [ruby-oauth/snaky_hash](https://gitlab.com/ruby-oauth/snaky_hash) gem for more ideas.
517
630
 
518
- #### What if I hate snakes and/or indifference?
631
+ #### Prefer camelCase over snake_case? => snaky: false
519
632
 
520
633
  ```ruby
521
634
  response = access.get("/api/resource", params: {"query_foo" => "bar"}, snaky: false)
@@ -570,6 +683,18 @@ using various class methods including the standard new, `from_hash` (if you have
570
683
  a hash of the values), or `from_kvform` (if you have an
571
684
  `application/x-www-form-urlencoded` encoded string of the values).
572
685
 
686
+ Options (since v2.0.x unless noted):
687
+ - expires_latency (Integer | nil): Seconds to subtract from expires_in when computing #expired? to offset latency.
688
+ - token_name (String | Symbol | nil): When multiple token-like fields exist in responses, select the field name to use as the access token (since v2.0.10).
689
+ - mode (Symbol | Proc | Hash): Controls how the token is transmitted on requests made via this AccessToken instance.
690
+ - :header — Send as Authorization: Bearer <token> header (default and preferred by OAuth 2.1 draft guidance).
691
+ - :query — Send as access_token query parameter (discouraged in general, but required by some providers).
692
+ - Verb-dependent (since v2.0.15): Provide either:
693
+ - a Proc taking |verb| and returning :header or :query, or
694
+ - a Hash with verb symbols as keys, for example: {get: :query, post: :header, delete: :header}.
695
+
696
+ Note: Verb-dependent mode was added in v2.0.15 to support providers like Instagram that require query mode for GET and header mode for POST/DELETE.
697
+
573
698
  ### OAuth2::Error
574
699
 
575
700
  On 400+ status code responses, an `OAuth2::Error` will be raised. If it is a
@@ -584,6 +709,22 @@ Response instance will contain the `OAuth2::Error` instance.
584
709
 
585
710
  ### Authorization Grants
586
711
 
712
+ Note on OAuth 2.1 (draft):
713
+ - PKCE is required for all OAuth clients using the authorization code flow (especially public clients). Implement PKCE in your app when required by your provider. See RFC 7636 and RFC 8252.
714
+ - Redirect URIs must be compared using exact string matching by the Authorization Server.
715
+ - The Implicit grant (response_type=token) and the Resource Owner Password Credentials grant are omitted from OAuth 2.1; they remain here for OAuth 2.0 compatibility but should be avoided for new apps.
716
+ - Bearer tokens in the query string are omitted due to security risks; prefer Authorization header usage.
717
+ - Refresh tokens for public clients must either be sender-constrained (e.g., DPoP/MTLS) or one-time use.
718
+ - The definitions of public and confidential clients are simplified to refer only to whether the client has credentials.
719
+
720
+ References:
721
+ - OAuth 2.1 draft: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-13
722
+ - Aaron Parecki: https://aaronparecki.com/2019/12/12/21/its-time-for-oauth-2-dot-1
723
+ - FusionAuth: https://fusionauth.io/blog/2020/04/15/whats-new-in-oauth-2-1
724
+ - Okta: https://developer.okta.com/blog/2019/12/13/oauth-2-1-how-many-rfcs
725
+ - Video: https://www.youtube.com/watch?v=g_aVPdwBTfw
726
+ - Differences overview: https://fusionauth.io/learn/expert-advice/oauth/differences-between-oauth-2-oauth-2-1/
727
+
587
728
  Currently, the Authorization Code, Implicit, Resource Owner Password Credentials, Client Credentials, and Assertion
588
729
  authentication grant types have helper strategy classes that simplify client
589
730
  use. They are available via the [`#auth_code`](https://gitlab.com/ruby-oauth/oauth2/-/blob/main/lib/oauth2/strategy/auth_code.rb),
@@ -674,6 +815,125 @@ resp = access.get("/v1/things")
674
815
  access = client.password.get_token("jdoe", "s3cret", scope: "read")
675
816
  ```
676
817
 
818
+ #### Examples
819
+
820
+ <details>
821
+ <summary>JHipster UAA (Spring Cloud) password grant example (legacy; avoid when possible)</summary>
822
+
823
+ ```ruby
824
+ # This converts a Postman/Net::HTTP multipart token request to oauth2 gem usage.
825
+ # JHipster UAA typically exposes the token endpoint at /uaa/oauth/token.
826
+ # The original snippet included:
827
+ # - Basic Authorization header for the client (web_app:changeit)
828
+ # - X-XSRF-TOKEN header from a cookie (some deployments require it)
829
+ # - grant_type=password with username/password and client_id
830
+ # Using oauth2 gem, you don't need to build multipart bodies; the gem sends
831
+ # application/x-www-form-urlencoded as required by RFC 6749.
832
+
833
+ require "oauth2"
834
+
835
+ client = OAuth2::Client.new(
836
+ "web_app", # client_id
837
+ "changeit", # client_secret
838
+ site: "http://localhost:8080/uaa",
839
+ token_url: "/oauth/token", # absolute under site (or "oauth/token" relative)
840
+ auth_scheme: :basic_auth, # sends HTTP Basic Authorization header
841
+ )
842
+
843
+ # If your UAA requires an XSRF header for the token call, provide it as a header.
844
+ # Often this is not required for token endpoints, but if your gateway enforces it,
845
+ # obtain the value from the XSRF-TOKEN cookie and pass it here.
846
+ xsrf_token = ENV["X_XSRF_TOKEN"] # e.g., pulled from a prior set-cookie value
847
+
848
+ access = client.password.get_token(
849
+ "admin", # username
850
+ "admin", # password
851
+ headers: xsrf_token ? {"X-XSRF-TOKEN" => xsrf_token} : {},
852
+ # JHipster commonly also accepts/needs the client_id in the body; include if required:
853
+ # client_id: "web_app",
854
+ )
855
+
856
+ puts access.token
857
+ puts access.to_hash # full token response
858
+ ```
859
+
860
+ Notes:
861
+ - Resource Owner Password Credentials (ROPC) is deprecated in OAuth 2.1 and discouraged. Prefer Authorization Code + PKCE.
862
+ - If your deployment strictly demands the X-XSRF-TOKEN header, first fetch it from an endpoint that sets the XSRF-TOKEN cookie (often "/" or a login page) and pass it to headers.
863
+ - For Basic auth, auth_scheme: :basic_auth handles the Authorization header; you do not need to base64-encode manually.
864
+
865
+ </details>
866
+
867
+ ### Instagram API (verb‑dependent token mode)
868
+
869
+ Providers like Instagram require the access token to be sent differently depending on the HTTP verb:
870
+ - GET requests: token must be in the query string (?access_token=...)
871
+ - POST/DELETE requests: token must be in the Authorization header (Bearer ...)
872
+
873
+ Since v2.0.15, you can configure an AccessToken with a verb‑dependent mode. The gem will choose how to send the token based on the request method.
874
+
875
+ Example: exchanging and refreshing long‑lived Instagram tokens, and making API calls
876
+
877
+ ```ruby
878
+ require "oauth2"
879
+
880
+ # NOTE: Users authenticate via Facebook Login to obtain a short‑lived user token (not shown here).
881
+ # See Facebook Login docs for obtaining the initial short‑lived token.
882
+
883
+ client = OAuth2::Client.new(nil, nil, site: "https://graph.instagram.com")
884
+
885
+ # Start with a short‑lived token you already obtained via Facebook Login
886
+ short_lived = OAuth2::AccessToken.new(
887
+ client,
888
+ ENV["IG_SHORT_LIVED_TOKEN"],
889
+ # Key part: verb‑dependent mode
890
+ mode: {get: :query, post: :header, delete: :header},
891
+ )
892
+
893
+ # 1) Exchange for a long‑lived token (Instagram requires GET with access_token in query)
894
+ # Endpoint: GET https://graph.instagram.com/access_token
895
+ # Params: grant_type=ig_exchange_token, client_secret=APP_SECRET
896
+ exchange = short_lived.get(
897
+ "/access_token",
898
+ params: {
899
+ grant_type: "ig_exchange_token",
900
+ client_secret: ENV["IG_APP_SECRET"],
901
+ # access_token param will be added automatically by the AccessToken (mode => :query for GET)
902
+ },
903
+ )
904
+ long_lived_token_value = exchange.parsed["access_token"]
905
+
906
+ long_lived = OAuth2::AccessToken.new(
907
+ client,
908
+ long_lived_token_value,
909
+ mode: {get: :query, post: :header, delete: :header},
910
+ )
911
+
912
+ # 2) Refresh the long‑lived token (Instagram uses GET with token in query)
913
+ # Endpoint: GET https://graph.instagram.com/refresh_access_token
914
+ refresh_resp = long_lived.get(
915
+ "/refresh_access_token",
916
+ params: {grant_type: "ig_refresh_token"},
917
+ )
918
+ long_lived = OAuth2::AccessToken.new(
919
+ client,
920
+ refresh_resp.parsed["access_token"],
921
+ mode: {get: :query, post: :header, delete: :header},
922
+ )
923
+
924
+ # 3) Typical API GET request (token in query automatically)
925
+ me = long_lived.get("/me", params: {fields: "id,username"}).parsed
926
+
927
+ # 4) Example POST (token sent via Bearer header automatically)
928
+ # Note: Replace the path/params with a real Instagram Graph API POST you need,
929
+ # such as publishing media via the Graph API endpoints.
930
+ # long_lived.post("/me/media", body: {image_url: "https://...", caption: "hello"})
931
+ ```
932
+
933
+ Tips:
934
+ - Avoid query‑string bearer tokens unless required by your provider. Instagram explicitly requires it for GET.
935
+ - If you need a custom rule, you can pass a Proc for mode, e.g. mode: ->(verb) { verb == :get ? :query : :header }.
936
+
677
937
  ### Refresh Tokens
678
938
 
679
939
  When the server issues a refresh_token, you can refresh manually or implement an auto-refresh wrapper.
@@ -740,7 +1000,55 @@ access.revoke(token_type_hint: :refresh_token)
740
1000
 
741
1001
  ### Client Configuration Tips
742
1002
 
743
- - Authentication schemes for the token request:
1003
+ #### Mutual TLS (mTLS) client authentication
1004
+
1005
+ Some providers require OAuth requests (including the token request and subsequent API calls) to be sender‑constrained using mutual TLS (mTLS). With this gem, you enable mTLS by providing a client certificate/private key to Faraday via connection_opts.ssl and, if your provider requires it for client authentication, selecting the tls_client_auth auth_scheme.
1006
+
1007
+ Example using PEM files (certificate and key):
1008
+
1009
+ ```ruby
1010
+ require "oauth2"
1011
+ require "openssl"
1012
+
1013
+ client = OAuth2::Client.new(
1014
+ ENV.fetch("CLIENT_ID"),
1015
+ ENV.fetch("CLIENT_SECRET"),
1016
+ site: "https://example.com",
1017
+ authorize_url: "/oauth/authorize/",
1018
+ token_url: "/oauth/token/",
1019
+ auth_scheme: :tls_client_auth, # if your AS requires mTLS-based client authentication
1020
+ connection_opts: {
1021
+ ssl: {
1022
+ client_cert: OpenSSL::X509::Certificate.new(File.read("localhost.pem")),
1023
+ client_key: OpenSSL::PKey::RSA.new(File.read("localhost-key.pem")),
1024
+ # Optional extras, uncomment as needed:
1025
+ # ca_file: "/path/to/ca-bundle.pem", # custom CA(s)
1026
+ # verify: true # enable server cert verification (recommended)
1027
+ },
1028
+ },
1029
+ )
1030
+
1031
+ # Example token request (any grant type can be used). The mTLS handshake
1032
+ # will occur automatically on HTTPS calls using the configured cert/key.
1033
+ access = client.client_credentials.get_token
1034
+
1035
+ # Subsequent resource requests will also use mTLS on HTTPS endpoints of `site`:
1036
+ resp = access.get("/v1/protected")
1037
+ ```
1038
+
1039
+ Notes:
1040
+ - Files must contain the appropriate PEMs. The private key may be encrypted; if so, pass a password to OpenSSL::PKey::RSA.new(File.read(path), ENV["KEY_PASSWORD"]).
1041
+ - If your certificate and key are in a PKCS#12/PFX bundle, you can load them like:
1042
+ - p12 = OpenSSL::PKCS12.new(File.read("client.p12"), ENV["P12_PASSWORD"])
1043
+ - client_cert = p12.certificate; client_key = p12.key
1044
+ - Server trust:
1045
+ - If your environment does not have system CAs, specify ca_file or ca_path inside the ssl: hash.
1046
+ - Keep verify: true in production. Set verify: false only for local testing.
1047
+ - Faraday adapter: Any adapter that supports Ruby’s OpenSSL should work. net_http (default) and net_http_persistent are common choices.
1048
+ - Scope of mTLS: The SSL client cert is applied to any HTTPS request made by this client (token and resource requests) to the configured site base URL (and absolute URLs you call with the same client).
1049
+ - OIDC tie-in: Some OPs require tls_client_auth at the token endpoint per OIDC/OAuth specifications. That is enabled via auth_scheme: :tls_client_auth as shown above.
1050
+
1051
+ #### Authentication schemes for the token request
744
1052
 
745
1053
  ```ruby
746
1054
  OAuth2::Client.new(
@@ -751,7 +1059,7 @@ OAuth2::Client.new(
751
1059
  )
752
1060
  ```
753
1061
 
754
- - Faraday connection, timeouts, proxy, custom adapter/middleware:
1062
+ #### Faraday connection, timeouts, proxy, custom adapter/middleware:
755
1063
 
756
1064
  ```ruby
757
1065
  client = OAuth2::Client.new(
@@ -770,7 +1078,52 @@ client = OAuth2::Client.new(
770
1078
  end
771
1079
  ```
772
1080
 
773
- - Redirection: The library follows up to `max_redirects` (default 5). You can override per-client via `options[:max_redirects]`.
1081
+ ##### Using flat query params (Faraday::FlatParamsEncoder)
1082
+
1083
+ Some APIs expect repeated key parameters to be sent as flat params rather than arrays. Faraday provides FlatParamsEncoder for this purpose. You can configure the oauth2 client to use it when building requests.
1084
+
1085
+ ```ruby
1086
+ require "faraday"
1087
+
1088
+ client = OAuth2::Client.new(
1089
+ id,
1090
+ secret,
1091
+ site: "https://api.example.com",
1092
+ # Pass Faraday connection options to make FlatParamsEncoder the default
1093
+ connection_opts: {
1094
+ request: {params_encoder: Faraday::FlatParamsEncoder},
1095
+ },
1096
+ ) do |faraday|
1097
+ faraday.request(:url_encoded)
1098
+ faraday.adapter(:net_http)
1099
+ end
1100
+
1101
+ access = client.client_credentials.get_token
1102
+
1103
+ # Example of a GET with two flat filter params (not an array):
1104
+ # Results in: ?filter=order.clientCreatedTime%3E1445006997000&filter=order.clientCreatedTime%3C1445611797000
1105
+ resp = access.get(
1106
+ "/v1/orders",
1107
+ params: {
1108
+ # Provide the values as an array; FlatParamsEncoder expands them as repeated keys
1109
+ filter: [
1110
+ "order.clientCreatedTime>1445006997000",
1111
+ "order.clientCreatedTime<1445611797000",
1112
+ ],
1113
+ },
1114
+ )
1115
+ ```
1116
+
1117
+ If you instead need to build a raw Faraday connection yourself, the equivalent configuration is:
1118
+
1119
+ ```ruby
1120
+ conn = Faraday.new("https://api.example.com", request: {params_encoder: Faraday::FlatParamsEncoder})
1121
+ ```
1122
+
1123
+ #### Redirection
1124
+
1125
+ The library follows up to `max_redirects` (default 5).
1126
+ You can override per-client via `options[:max_redirects]`.
774
1127
 
775
1128
  ### Handling Responses and Errors
776
1129
 
@@ -823,6 +1176,7 @@ access = client.get_token({
823
1176
 
824
1177
  - If the token response includes an `id_token` (a JWT), this gem surfaces it but does not validate the signature. Use a JWT library and your provider's JWKs to verify it.
825
1178
  - For private_key_jwt client authentication, provide `auth_scheme: :private_key_jwt` and ensure your key configuration matches the provider requirements.
1179
+ - See [OIDC.md](OIDC.md) for a more complete OIDC overview, example, and links to the relevant specifications.
826
1180
 
827
1181
  ### Debugging
828
1182
 
@@ -887,7 +1241,10 @@ I’m developing a new library, [floss_funding][🖇floss-funding-gem], designed
887
1241
 
888
1242
  ## 🔐 Security
889
1243
 
890
- See [SECURITY.md][🔐security].
1244
+ To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
1245
+ Tidelift will coordinate the fix and disclosure.
1246
+
1247
+ For more see [SECURITY.md][🔐security].
891
1248
 
892
1249
  ## 🤝 Contributing
893
1250
 
@@ -1009,7 +1366,7 @@ To join the community or get help 👇️ Join the Discord.
1009
1366
 
1010
1367
  [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]
1011
1368
 
1012
- To say "thanks for maintaining such a great tool" ☝️ Join the Discord or 👇️ send money.
1369
+ To say "thanks!" ☝️ Join the Discord or 👇️ send money.
1013
1370
 
1014
1371
  [![Sponsor ruby-oauth/oauth2 on Open Source Collective][🖇osc-all-bottom-img]][🖇osc] 💌 [![Sponsor me on GitHub Sponsors][🖇sponsor-bottom-img]][🖇sponsor] 💌 [![Sponsor me on Liberapay][⛳liberapay-bottom-img]][⛳liberapay-img] 💌 [![Donate on PayPal][🖇paypal-bottom-img]][🖇paypal-img]
1015
1372
 
@@ -1036,11 +1393,11 @@ Thanks for RTFM. ☺️
1036
1393
  [🖇sponsor]: https://github.com/sponsors/pboling
1037
1394
  [🖇polar-img]: https://img.shields.io/badge/polar-donate-a51611.svg?style=flat
1038
1395
  [🖇polar]: https://polar.sh/pboling
1039
- [🖇kofi-img]: https://img.shields.io/badge/ko--fi-✓-a51611.svg?style=flat
1396
+ [🖇kofi-img]: https://img.shields.io/badge/ko--fi-%E2%9C%93-a51611.svg?style=flat
1040
1397
  [🖇kofi]: https://ko-fi.com/O5O86SNP4
1041
1398
  [🖇patreon-img]: https://img.shields.io/badge/patreon-donate-a51611.svg?style=flat
1042
1399
  [🖇patreon]: https://patreon.com/galtzo
1043
- [🖇buyme-small-img]: https://img.shields.io/badge/buy_me_a_coffee-✓-a51611.svg?style=flat
1400
+ [🖇buyme-small-img]: https://img.shields.io/badge/buy_me_a_coffee-%E2%9C%93-a51611.svg?style=flat
1044
1401
  [🖇buyme-img]: https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff
1045
1402
  [🖇buyme]: https://www.buymeacoffee.com/pboling
1046
1403
  [🖇paypal-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=flat&logo=paypal
@@ -1067,12 +1424,12 @@ Thanks for RTFM. ☺️
1067
1424
  [🚂maint-contact-img]: https://img.shields.io/badge/Contact-Maintainer-0093D0.svg?style=flat&logo=rubyonrails&logoColor=red
1068
1425
  [💖🖇linkedin]: http://www.linkedin.com/in/peterboling
1069
1426
  [💖🖇linkedin-img]: https://img.shields.io/badge/PeterBoling-LinkedIn-0B66C2?style=flat&logo=newjapanprowrestling
1070
- [💖✌️wellfound]: https://wellfound.com/u/peter-boling/u/peter-boling
1427
+ [💖✌️wellfound]: https://wellfound.com/u/peter-boling
1071
1428
  [💖✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=flat&logo=wellfound
1072
1429
  [💖💲crunchbase]: https://www.crunchbase.com/person/peter-boling
1073
1430
  [💖💲crunchbase-img]: https://img.shields.io/badge/peter--boling-purple?style=flat&logo=crunchbase
1074
1431
  [💖🐘ruby-mast]: https://ruby.social/@galtzo
1075
- [💖🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https%3A%2F%2Fruby.social&style=flat&logo=mastodon&label=Ruby%20%40galtzo
1432
+ [💖🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https://ruby.social&style=flat&logo=mastodon&label=Ruby%20@galtzo
1076
1433
  [💖🦋bluesky]: https://bsky.app/profile/galtzo.com
1077
1434
  [💖🦋bluesky-img]: https://img.shields.io/badge/@galtzo.com-0285FF?style=flat&logo=bluesky&logoColor=white
1078
1435
  [💖🌳linktree]: https://linktr.ee/galtzo
@@ -1142,8 +1499,8 @@ Thanks for RTFM. ☺️
1142
1499
  [🚎10-j-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/jruby.yml/badge.svg
1143
1500
  [🚎11-c-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/current.yml
1144
1501
  [🚎11-c-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/current.yml/badge.svg
1145
- [🚎12-crh-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/current-runtime-heads.yml
1146
- [🚎12-crh-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/current-runtime-heads.yml/badge.svg
1502
+ [🚎12-crh-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/dep-heads.yml
1503
+ [🚎12-crh-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/dep-heads.yml/badge.svg
1147
1504
  [🚎13-cbs-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/caboose.yml
1148
1505
  [🚎13-cbs-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/caboose.yml/badge.svg
1149
1506
  [🚎13-🔒️-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/locked_deps.yml
@@ -1197,7 +1554,7 @@ Thanks for RTFM. ☺️
1197
1554
  [📗keep-changelog]: https://keepachangelog.com/en/1.0.0/
1198
1555
  [📗keep-changelog-img]: https://img.shields.io/badge/keep--a--changelog-1.0.0-34495e.svg?style=flat
1199
1556
  [📌gitmoji]:https://gitmoji.dev
1200
- [📌gitmoji-img]:https://img.shields.io/badge/gitmoji_commits-%20😜%20😍-34495e.svg?style=flat-square
1557
+ [📌gitmoji-img]:https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
1201
1558
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
1202
1559
  [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.519-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1203
1560
  [🔐security]: SECURITY.md
@@ -1213,7 +1570,7 @@ Thanks for RTFM. ☺️
1213
1570
  [💎stone_checksums]: https://github.com/galtzo-floss/stone_checksums
1214
1571
  [💎SHA_checksums]: https://gitlab.com/ruby-oauth/oauth2/-/tree/main/checksums
1215
1572
  [💎rlts]: https://github.com/rubocop-lts/rubocop-lts
1216
- [💎rlts-img]: https://img.shields.io/badge/code_style_%26_linting-rubocop--lts-34495e.svg?plastic&logo=ruby&logoColor=white
1573
+ [💎rlts-img]: https://img.shields.io/badge/code_style_&_linting-rubocop--lts-34495e.svg?plastic&logo=ruby&logoColor=white
1217
1574
  [💎appraisal2]: https://github.com/appraisal-rb/appraisal2
1218
1575
  [💎appraisal2-img]: https://img.shields.io/badge/appraised_by-appraisal2-34495e.svg?plastic&logo=ruby&logoColor=white
1219
1576
  [💎d-in-dvcs]: https://railsbling.com/posts/dvcs/put_the_d_in_dvcs/
@@ -1223,8 +1580,8 @@ Thanks for RTFM. ☺️
1223
1580
  rel="me" Social Proofs
1224
1581
  </summary>
1225
1582
 
1226
- <a rel="me" alt="Follow me on Ruby.social" href="https://ruby.social/@galtzo"><img src="https://img.shields.io/mastodon/follow/109447111526622197?domain=https%3A%2F%2Fruby.social&style=social&label=Follow%20%40galtzo%20on%20Ruby.social"></a>
1227
- <a rel="me" alt="Follow me on FLOSS.social" href="https://floss.social/@galtzo"><img src="https://img.shields.io/mastodon/follow/110304921404405715?domain=https%3A%2F%2Ffloss.social&style=social&label=Follow%20%40galtzo%20on%20Floss.social"></a>
1583
+ <a rel="me" alt="Follow me on Ruby.social" href="https://ruby.social/@galtzo"><img src="https://img.shields.io/mastodon/follow/109447111526622197?domain=https://ruby.social&style=social&label=Follow%20@galtzo%20on%20Ruby.social"></a>
1584
+ <a rel="me" alt="Follow me on FLOSS.social" href="https://floss.social/@galtzo"><img src="https://img.shields.io/mastodon/follow/110304921404405715?domain=https://floss.social&style=social&label=Follow%20@galtzo%20on%20Floss.social"></a>
1228
1585
 
1229
1586
  </details>
1230
1587