oauth2 1.4.11 → 2.0.20

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +802 -85
  4. data/CITATION.cff +20 -0
  5. data/CODE_OF_CONDUCT.md +24 -23
  6. data/CONTRIBUTING.md +211 -34
  7. data/FUNDING.md +74 -0
  8. data/IRP.md +107 -0
  9. data/{LICENSE → LICENSE.txt} +2 -2
  10. data/OIDC.md +167 -0
  11. data/README.md +1389 -290
  12. data/REEK +2 -0
  13. data/RUBOCOP.md +71 -0
  14. data/SECURITY.md +13 -15
  15. data/THREAT_MODEL.md +94 -0
  16. data/lib/oauth2/access_token.rb +273 -39
  17. data/lib/oauth2/auth_sanitizer.rb +36 -0
  18. data/lib/oauth2/authenticator.rb +48 -9
  19. data/lib/oauth2/client.rb +414 -129
  20. data/lib/oauth2/error.rb +61 -24
  21. data/lib/oauth2/filtered_attributes.rb +10 -0
  22. data/lib/oauth2/response.rb +136 -43
  23. data/lib/oauth2/strategy/assertion.rb +68 -40
  24. data/lib/oauth2/strategy/auth_code.rb +25 -4
  25. data/lib/oauth2/strategy/base.rb +0 -0
  26. data/lib/oauth2/strategy/client_credentials.rb +3 -3
  27. data/lib/oauth2/strategy/implicit.rb +17 -2
  28. data/lib/oauth2/strategy/password.rb +14 -4
  29. data/lib/oauth2/version.rb +2 -59
  30. data/lib/oauth2.rb +101 -12
  31. data/sig/oauth2/access_token.rbs +25 -0
  32. data/sig/oauth2/authenticator.rbs +22 -0
  33. data/sig/oauth2/client.rbs +52 -0
  34. data/sig/oauth2/error.rbs +8 -0
  35. data/sig/oauth2/filtered_attributes.rbs +11 -0
  36. data/sig/oauth2/response.rbs +18 -0
  37. data/sig/oauth2/sanitized_logger.rbs +32 -0
  38. data/sig/oauth2/strategy.rbs +34 -0
  39. data/sig/oauth2/thing_filter.rbs +10 -0
  40. data/sig/oauth2/version.rbs +5 -0
  41. data/sig/oauth2.rbs +9 -0
  42. data.tar.gz.sig +0 -0
  43. metadata +304 -83
  44. metadata.gz.sig +4 -0
  45. data/lib/oauth2/mac_token.rb +0 -130
data/README.md CHANGED
@@ -1,277 +1,304 @@
1
- <p align="center">
2
- <a href="http://oauth.net/2/" target="_blank" rel="noopener">
3
- <img src="https://github.com/oauth-xx/oauth2/raw/main/docs/images/logo/oauth2-logo-124px.png?raw=true" alt="OAuth 2.0 Logo by Chris Messina, CC BY-SA 3.0">
4
- </a>
5
- <a href="https://www.ruby-lang.org/" target="_blank" rel="noopener">
6
- <img width="124px" src="https://github.com/oauth-xx/oauth2/raw/main/docs/images/logo/ruby-logo-198px.svg?raw=true" alt="Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5">
7
- </a>
8
- </p>
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]
9
2
 
10
- ## What
3
+ [🖼️galtzo-i]: https://logos.galtzo.com/assets/images/galtzo-floss/avatar-192px.svg
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
+
10
+ # 🔐 OAuth 2.0 Authorization Framework
11
+
12
+ [![Version][👽versioni]][👽version] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license-ref] [![Downloads Rank][👽dl-ranki]][👽dl-rank] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![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 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] [![Apache SkyWalking Eyes License Compatibility Check][🚎15-🪪-wfi]][🚎15-🪪-wf]
13
+
14
+ `if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know][🖼️galtzo-discord], as I may have missed the [discord notification][🖼️galtzo-discord].
15
+
16
+ ---
17
+
18
+ `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.
19
+
20
+ [![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 at ko-fi.com][🖇kofi-img]][🖇kofi]
21
+
22
+ <details>
23
+ <summary>👣 How will this project approach the September 2025 hostile takeover of RubyGems? 🚑️</summary>
24
+
25
+ I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-takeover-of-rubygems-my-thoughts-5hlo).
26
+
27
+ </details>
28
+
29
+ ## 🌻 Synopsis
11
30
 
12
31
  OAuth 2.0 is the industry-standard protocol for authorization.
13
- OAuth 2.0 focuses on client developer simplicity while providing specific authorization flows for web applications,
14
- desktop applications, mobile phones, and living room devices.
15
- This is a RubyGem for implementing OAuth 2.0 clients and servers in Ruby applications.
16
- See the sibling `oauth` gem for OAuth 1.0 implementations in Ruby.
32
+ This is a RubyGem for implementing OAuth 2.0 clients (not servers) in Ruby applications.
17
33
 
18
- ⚠️⚠️⚠️ **_WARNING_**: You are viewing the `README` of the
19
- [supported-only-for-critical-enterprise-security-issues](#oauth2-for-enterprise) `1-4-stable`
20
- branch. Please do not use this, and instead upgrade to version 2! ⚠️⚠️⚠️
34
+ ⭐️ including OAuth 2.1 draft spec & OpenID Connect (OIDC)
21
35
 
22
- No further releases of 1.x series are planned! [Version 2](https://gitlab.com/oauth-xx/oauth2/#what-is-new-for-v20) has *tons* of improvements!
36
+ ### Quick Examples
23
37
 
24
- If you must continue using 1.4.x please consider purchasing an open source security maintenance contract from [Tidelift][tidelift-ref].
38
+ <details markdown="1">
39
+ <summary>Convert the following `curl` command into a token request using this gem...</summary>
25
40
 
26
- ---
41
+ ```shell
42
+ curl --request POST \
43
+ --url 'https://login.microsoftonline.com/REDMOND_REDACTED/oauth2/token' \
44
+ --header 'content-type: application/x-www-form-urlencoded' \
45
+ --data grant_type=client_credentials \
46
+ --data client_id=REDMOND_CLIENT_ID \
47
+ --data client_secret=REDMOND_CLIENT_SECRET \
48
+ --data resource=REDMOND_RESOURCE_UUID
49
+ ```
27
50
 
28
- * [OAuth 2.0 Spec][oauth2-spec]
29
- * [OAuth 1.0 sibling gem][sibling-gem]
51
+ NOTE: In the ruby version below, certain params are passed to the `get_token` call, instead of the client creation.
30
52
 
31
- [oauth2-spec]: https://oauth.net/2/
32
- [sibling-gem]: https://gitlab.com/oauth-xx/oauth
53
+ ```ruby
54
+ client = OAuth2::Client.new(
55
+ "REDMOND_CLIENT_ID", # client_id
56
+ "REDMOND_CLIENT_SECRET", # client_secret
57
+ auth_scheme: :request_body, # Other modes are supported: :basic_auth, :tls_client_auth, :private_key_jwt
58
+ token_url: "oauth2/token", # relative path, except with leading `/`, then absolute path
59
+ site: "https://login.microsoftonline.com/REDMOND_REDACTED",
60
+ )
61
+ client.
62
+ client_credentials. # There are many other types to choose from!
63
+ get_token(resource: "REDMOND_RESOURCE_UUID")
64
+ ```
33
65
 
34
- ## Release Documentation
66
+ NOTE: `header` - The content type specified in the `curl` is already the default!
35
67
 
36
- <details>
37
- <summary>1.4.x Readmes</summary>
38
-
39
- | Version | Release Date | Readme |
40
- |---------|--------------|-------------------------------------------------------------|
41
- | 1.4.11 | Sep 16, 2022 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.11/README.md |
42
- | 1.4.10 | Jul 1, 2022 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.10/README.md |
43
- | 1.4.9 | Feb 20, 2022 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.9/README.md |
44
- | 1.4.8 | Feb 18, 2022 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.8/README.md |
45
- | 1.4.7 | Mar 19, 2021 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.7/README.md |
46
- | 1.4.6 | Mar 19, 2021 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.6/README.md |
47
- | 1.4.5 | Mar 18, 2021 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.5/README.md |
48
- | 1.4.4 | Feb 12, 2020 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.4/README.md |
49
- | 1.4.3 | Jan 29, 2020 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.3/README.md |
50
- | 1.4.2 | Oct 1, 2019 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.2/README.md |
51
- | 1.4.1 | Oct 13, 2018 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.1/README.md |
52
- | 1.4.0 | Jun 9, 2017 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.0/README.md |
53
68
  </details>
54
69
 
55
- <details>
56
- <summary>1.3.x Readmes</summary>
70
+ <details markdown="1">
71
+ <summary>Complete E2E single file script against mock-oauth2-server</summary>
72
+
73
+ - E2E example uses [navikt/mock-oauth2-server](https://github.com/navikt/mock-oauth2-server), which was added in v2.0.11
74
+ - E2E example does not ship with the released gem, so clone the source to play with it.
75
+
76
+ ```console
77
+ docker compose -f docker-compose-ssl.yml up -d --wait
78
+ ruby examples/e2e.rb
79
+ # If your machine is slow or Docker pulls are cold, increase the wait:
80
+ E2E_WAIT_TIMEOUT=120 ruby examples/e2e.rb
81
+ # The mock server serves HTTP on 8080; the example points to http://localhost:8080 by default.
82
+ ```
83
+
84
+ The output should be something like this:
85
+
86
+ ```console
87
+ ➜ ruby examples/e2e.rb
88
+ Access token (truncated): eyJraWQiOiJkZWZhdWx0...
89
+ userinfo status: 200
90
+ userinfo body: {"sub" => "demo-sub", "aud" => ["demo-aud"], "nbf" => 1757816758000, "iss" => "http://localhost:8080/default", "exp" => 1757820358000, "iat" => 1757816758000, "jti" => "d63b97a7-ebe5-4dea-93e6-d542caba6104"}
91
+ E2E complete
92
+ ```
93
+
94
+ Make sure to shut down the mock server when you are done:
95
+
96
+ ```console
97
+ docker compose -f docker-compose-ssl.yml down
98
+ ```
99
+
100
+ Troubleshooting: validate connectivity to the mock server
101
+
102
+ - Check container status and port mapping:
103
+ - `docker compose -f docker-compose-ssl.yml ps`
104
+ - From the host, try the discovery URL directly (this is what the example uses by default):
105
+ - `curl -v http://localhost:8080/default/.well-known/openid-configuration`
106
+ - If that fails immediately, also try: `curl -v --connect-timeout 2 http://127.0.0.1:8080/default/.well-known/openid-configuration`
107
+ - From inside the container (to distinguish container vs. host networking):
108
+ - `docker exec -it oauth2-mock-oauth2-server-1 curl -v http://127.0.0.1:8080/default/.well-known/openid-configuration`
109
+ - Simple TCP probe from the host:
110
+ - `nc -vz localhost 8080 # or: ruby -rsocket -e 'TCPSocket.new("localhost",8080).close; puts "tcp ok"'`
111
+ - Inspect which host port 8080 is bound to (should be 8080):
112
+ - `docker inspect -f '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' oauth2-mock-oauth2-server-1`
113
+ - Look at server logs for readiness/errors:
114
+ - `docker logs -n 200 oauth2-mock-oauth2-server-1`
115
+ - On Linux, ensure nothing else is bound to 8080 and that firewall/SELinux aren’t blocking:
116
+ - `ss -ltnp | grep :8080`
117
+
118
+ Notes
119
+
120
+ - Discovery URL pattern is: `http://localhost:8080/<realm>/.well-known/openid-configuration`, where `<realm>` defaults to `default`.
121
+ - You can change these with env vars when running the example:
122
+ - `E2E_ISSUER_BASE` (default: http://localhost:8080)
123
+ - `E2E_REALM` (default: default)
57
124
 
58
- | Version | Release Date | Readme |
59
- |----------|--------------|----------------------------------------------------------|
60
- | 1.3.1 | Mar 3, 2017 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.3.1/README.md |
61
- | 1.3.0 | Dec 27, 2016 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.3.0/README.md |
62
125
  </details>
63
126
 
64
- <details>
65
- <summary>&le;= 1.2.x Readmes (2016 and before)</summary>
66
-
67
- | Version | Release Date | Readme |
68
- |----------|--------------|----------------------------------------------------------|
69
- | 1.2.0 | Jun 30, 2016 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.2.0/README.md |
70
- | 1.1.0 | Jan 30, 2016 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.1.0/README.md |
71
- | 1.0.0 | May 23, 2014 | https://gitlab.com/oauth-xx/oauth2/-/blob/v1.0.0/README.md |
72
- | < 1.0.0 | Find here | https://gitlab.com/oauth-xx/oauth2/-/tags |
127
+ If it seems like you are in the wrong place, you might try one of these:
128
+
129
+ * [OAuth 2.0 Spec][oauth2-spec]
130
+ * [doorkeeper gem][doorkeeper-gem] for OAuth 2.0 server/provider implementation.
131
+ * [oauth sibling gem][sibling-gem] for OAuth 1.0a implementations in Ruby.
132
+
133
+ [oauth2-spec]: https://oauth.net/2/
134
+ [sibling-gem]: https://gitlab.com/ruby-oauth/oauth
135
+ [doorkeeper-gem]: https://github.com/doorkeeper-gem/doorkeeper
136
+
137
+ ## 💡 Info you can shake a stick at
138
+
139
+ | Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
140
+ |-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
141
+ | 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] |
142
+ | Works with Truffle Ruby | ![Truffle Ruby 22.3 Compat][💎truby-22.3i] ![Truffle Ruby 23.0 Compat][💎truby-23.0i] ![Truffle Ruby 23.1 Compat][💎truby-23.1i] <br/> [![Truffle Ruby 24.1 Compat][💎truby-c-i]][🚎11-c-wf] |
143
+ | 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] |
144
+ | 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] |
145
+ | Support & Community | [![Join Me on Daily.dev's RubyFriends][✉️ruby-friends-img]][✉️ruby-friends] [![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] |
146
+ | 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] |
147
+ | 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] [![GitLab Wiki][📜gl-wiki-img]][📜gl-wiki] [![GitHub Wiki][📜gh-wiki-img]][📜gh-wiki] |
148
+ | Compliance | [![License: MIT][📄license-img]][📄license-ref] [![Compatible with Apache Software Projects: Verified by SkyWalking Eyes][📄license-compat-img]][📄license-compat] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |
149
+ | 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] |
150
+ | 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] |
151
+ | `...` 💖 | [![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] |
152
+
153
+ ### Compatibility
154
+
155
+ Compatible with MRI Ruby 2.2.0+, and concordant releases of JRuby, and TruffleRuby.
156
+
157
+ | 🚚 _Amazing_ test matrix was brought to you by | 🔎 appraisal2 🔎 and the color 💚 green 💚 |
158
+ |------------------------------------------------|--------------------------------------------------------|
159
+ | 👟 Check it out! | ✨ [github.com/appraisal-rb/appraisal2][💎appraisal2] ✨ |
160
+
161
+ ### Federated DVCS
162
+
163
+ <details markdown="1">
164
+ <summary>Find this repo on federated forges (Coming soon!)</summary>
165
+
166
+ | Federated [DVCS][💎d-in-dvcs] Repository | Status | Issues | PRs | Wiki | CI | Discussions |
167
+ |-------------------------------------------------|-----------------------------------------------------------------------|---------------------------|--------------------------|---------------------------|--------------------------|------------------------------|
168
+ | 🧪 [ruby-oauth/oauth2 on GitLab][📜src-gl] | The Truth | [💚][🤝gl-issues] | [💚][🤝gl-pulls] | [💚][📜gl-wiki] | 🐭 Tiny Matrix | ➖ |
169
+ | 🧊 [ruby-oauth/oauth2 on CodeBerg][📜src-cb] | An Ethical Mirror ([Donate][🤝cb-donate]) | [💚][🤝cb-issues] | [💚][🤝cb-pulls] | ➖ | ⭕️ No Matrix | ➖ |
170
+ | 🐙 [ruby-oauth/oauth2 on GitHub][📜src-gh] | Another Mirror | [💚][🤝gh-issues] | [💚][🤝gh-pulls] | [💚][📜gh-wiki] | 💯 Full Matrix | [💚][gh-discussions] |
171
+ | 🎮️ [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] |
172
+
73
173
  </details>
74
174
 
75
- ## Status
76
-
77
- <!--
78
- Numbering rows and badges in each row as a visual "database" lookup,
79
- as the table is extremely dense, and it can be very difficult to find anything
80
- Putting one on each row here, to document the emoji that should be used, and for ease of copy/paste.
81
-
82
- row #s:
83
- 1️⃣
84
- 2️⃣
85
- 3️⃣
86
- 4️⃣
87
- 5️⃣
88
- 6️⃣
89
- 7️⃣
90
-
91
- badge #s:
92
- ⛳️
93
- 🖇
94
- 🏘
95
- 🚎
96
- 🖐
97
- 🧮
98
- 📗
99
-
100
- appended indicators:
101
- ♻️ - URL needs to be updated from SASS integration. Find / Replace is insufficient.
102
- -->
103
-
104
- | | Project | bundle add oauth2 |
105
- |:----|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
106
- | 1️⃣ | name, license, docs | [![RubyGems.org][⛳️name-img]][⛳️gem] [![License: MIT][🖇src-license-img]][🖇src-license] [![FOSSA][🏘fossa-img]][🏘fossa] [![RubyDoc.info][🚎yard-img]][🚎yard] [![InchCI][🖐inch-ci-img]][🚎yard] |
107
- | 2️⃣ | version & activity | [![Gem Version][⛳️version-img]][⛳️gem] [![Total Downloads][🖇DL-total-img]][⛳️gem] [![Download Rank][🏘DL-rank-img]][⛳️gem] [![Source Code][🚎src-home-img]][🚎src-home] |
108
- | 3️⃣ | maintanence & linting | [![Maintainability][⛳cclim-maint-img♻️]][⛳cclim-maint] [![Helpers][🖇triage-help-img]][🖇triage-help] [![Depfu][🏘depfu-img♻️]][🏘depfu♻️] [![Contributors][🚎contributors-img]][🚎contributors] [![Style][🖐style-wf-img]][🖐style-wf] [![Kloc Roll][🧮kloc-img]][🧮kloc] |
109
- | 4️⃣ | testing | [![Supported][🏘sup-wf-img]][🏘sup-wf] [![Heads][🚎heads-wf-img]][🚎heads-wf] [![Unofficial Support][🖐uns-wf-img]][🖐uns-wf] [![MacOS][🧮mac-wf-img]][🧮mac-wf] [![Windows][📗win-wf-img]][📗win-wf] |
110
- | 5️⃣ | coverage & security | [![CodeClimate][⛳cclim-cov-img♻️]][⛳cclim-cov] [![CodeCov][🖇codecov-img♻️]][🖇codecov] [![Coveralls][🏘coveralls-img]][🏘coveralls] [![Security Policy][🚎sec-pol-img]][🚎sec-pol] [![CodeQL][🖐codeQL-img]][🖐codeQL] [![Code Coverage][🧮cov-wf-img]][🧮cov-wf] |
111
- | 6️⃣ | resources | [![Discussion][⛳gg-discussions-img]][⛳gg-discussions] [![Get help on Codementor][🖇codementor-img]][🖇codementor] [![Chat][🏘chat-img]][🏘chat] [![Blog][🚎blog-img]][🚎blog] [![Blog][🖐wiki-img]][🖐wiki] |
112
- | 7️⃣ | spread 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Tweet @ Peter][🏘tweet-img]][🏘tweet] [🌏][aboutme] [👼][angelme] [💻][coderme] |
113
-
114
- <!--
115
- The link tokens in the following sections should be kept ordered by the row and badge numbering scheme
116
- -->
117
-
118
- <!-- 1️⃣ name, license, docs -->
119
- [⛳️gem]: https://rubygems.org/gems/oauth2
120
- [⛳️name-img]: https://img.shields.io/badge/name-oauth2-brightgreen.svg?style=flat
121
- [🖇src-license]: https://opensource.org/licenses/MIT
122
- [🖇src-license-img]: https://img.shields.io/badge/License-MIT-green.svg
123
- [🏘fossa]: https://app.fossa.io/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2?ref=badge_shield
124
- [🏘fossa-img]: https://app.fossa.io/api/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2.svg?type=shield
125
- [🚎yard]: https://www.rubydoc.info/github/oauth-xx/oauth2
126
- [🚎yard-img]: https://img.shields.io/badge/documentation-rubydoc-brightgreen.svg?style=flat
127
- [🖐inch-ci-img]: http://inch-ci.org/github/oauth-xx/oauth2.png
128
-
129
- <!-- 2️⃣ version & activity -->
130
- [⛳️version-img]: http://img.shields.io/gem/v/oauth2.svg
131
- [🖇DL-total-img]: https://img.shields.io/gem/dt/oauth2.svg
132
- [🏘DL-rank-img]: https://img.shields.io/gem/rt/oauth2.svg
133
- [🚎src-home]: https://gitlab.com/oauth-xx/oauth2/
134
- [🚎src-home-img]: https://img.shields.io/badge/source-gitlab-blue.svg?style=flat
135
-
136
- <!-- 3️⃣ maintenance & linting -->
137
- [⛳cclim-maint]: https://codeclimate.com/github/oauth-xx/oauth2/maintainability
138
- [⛳cclim-maint-img♻️]: https://api.codeclimate.com/v1/badges/688c612528ff90a46955/maintainability
139
- [🖇triage-help]: https://www.codetriage.com/oauth-xx/oauth2
140
- [🖇triage-help-img]: https://www.codetriage.com/oauth-xx/oauth2/badges/users.svg
141
- [🏘depfu♻️]: https://depfu.com/github/oauth-xx/oauth2?project_id=4445
142
- [🏘depfu-img♻️]: https://badges.depfu.com/badges/6d34dc1ba682bbdf9ae2a97848241743/count.svg
143
- [🚎contributors]: https://gitlab.com/oauth-xx/oauth2/-/graphs/main
144
- [🚎contributors-img]: https://img.shields.io/github/contributors-anon/oauth-xx/oauth2
145
- [🖐style-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/style.yml
146
- [🖐style-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/style.yml/badge.svg
147
- [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
148
- [🧮kloc-img]: https://img.shields.io/tokei/lines/github.com/oauth-xx/oauth2
149
-
150
- <!-- 4️⃣ testing -->
151
- [🏘sup-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/supported.yml
152
- [🏘sup-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/supported.yml/badge.svg
153
- [🚎heads-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/heads.yml
154
- [🚎heads-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/heads.yml/badge.svg
155
- [🖐uns-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/unsupported.yml
156
- [🖐uns-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/unsupported.yml/badge.svg
157
- [🧮mac-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/macos.yml
158
- [🧮mac-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/macos.yml/badge.svg
159
- [📗win-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/windows.yml
160
- [📗win-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/windows.yml/badge.svg
161
-
162
- <!-- 5️⃣ coverage & security -->
163
- [⛳cclim-cov]: https://codeclimate.com/github/oauth-xx/oauth2/test_coverage
164
- [⛳cclim-cov-img♻️]: https://api.codeclimate.com/v1/badges/688c612528ff90a46955/test_coverage
165
- [🖇codecov-img♻️]: https://codecov.io/gh/oauth-xx/oauth2/branch/1-4-stable/graph/badge.svg?token=bNqSzNiuo2
166
- [🖇codecov]: https://codecov.io/gh/oauth-xx/oauth2
167
- [🏘coveralls]: https://coveralls.io/github/oauth-xx/oauth2?branch=1-4-stable
168
- [🏘coveralls-img]: https://coveralls.io/repos/github/oauth-xx/oauth2/badge.svg?branch=1-4-stable
169
- [🚎sec-pol]: https://gitlab.com/oauth-xx/oauth2/-/blob/main/SECURITY.md
170
- [🚎sec-pol-img]: https://img.shields.io/badge/security-policy-brightgreen.svg?style=flat
171
- [🖐codeQL]: https://github.com/oauth-xx/oauth2/security/code-scanning
172
- [🖐codeQL-img]: https://github.com/oauth-xx/oauth2/actions/workflows/codeql-analysis.yml/badge.svg
173
- [🧮cov-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/coverage.yml
174
- [🧮cov-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/coverage.yml/badge.svg
175
-
176
- <!-- 6️⃣ resources -->
177
- [⛳gg-discussions]: https://groups.google.com/g/oauth-ruby
178
- [⛳gg-discussions-img]: https://img.shields.io/badge/google-group-purple.svg?style=flat
179
- [🖇codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
180
- [🖇codementor-img]: https://cdn.codementor.io/badges/get_help_github.svg
181
- [🏘chat]: https://gitter.im/oauth-xx/oauth2
182
- [🏘chat-img]: https://img.shields.io/gitter/room/oauth-xx/oauth2.svg
183
- [🚎blog]: http://www.railsbling.com/tags/oauth2/
184
- [🚎blog-img]: https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat
185
- [🖐wiki]: https://gitlab.com/oauth-xx/oauth2/-/wikis/home
186
- [🖐wiki-img]: https://img.shields.io/badge/wiki-examples-brightgreen.svg?style=flat
187
-
188
- <!-- 7️⃣ spread 💖 -->
189
- [⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
190
- [⛳liberapay]: https://liberapay.com/pboling/donate
191
- [🖇sponsor-img]: https://img.shields.io/badge/sponsor-pboling.svg?style=social&logo=github
192
- [🖇sponsor]: https://github.com/sponsors/pboling
193
- [🏘tweet-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
194
- [🏘tweet]: http://twitter.com/galtzo
175
+ [gh-discussions]: https://github.com/ruby-oauth/oauth2/discussions
176
+
177
+ ### 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)
178
+
179
+ Available as part of the Tidelift Subscription.
180
+
181
+ <details markdown="1">
182
+ <summary>Need enterprise-level guarantees?</summary>
183
+
184
+ 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.
195
185
 
196
- <!-- Maintainer Contact Links -->
197
- [railsbling]: http://www.railsbling.com
198
- [peterboling]: http://www.peterboling.com
199
- [aboutme]: https://about.me/peter.boling
200
- [angelme]: https://angel.co/peter-boling
201
- [coderme]:http://coderwall.com/pboling
186
+ [![Get help from me on Tidelift][🏙️entsup-tidelift-img]][🏙️entsup-tidelift]
202
187
 
203
- ## Installation
188
+ - 💡Subscribe for support guarantees covering _all_ your FLOSS dependencies
189
+ - 💡Tidelift is part of [Sonar][🏙️entsup-tidelift-sonar]
190
+ - 💡Tidelift pays maintainers to maintain the software you depend on!<br/>📊`@`Pointy Haired Boss: An [enterprise support][🏙️entsup-tidelift] subscription is "[never gonna let you down][🧮kloc]", and *supports* open source maintainers
191
+
192
+ Alternatively:
193
+
194
+ - [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]
195
+ - [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork]
196
+ - [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor]
197
+
198
+ </details>
199
+
200
+ ## ✨ Installation
204
201
 
205
202
  Install the gem and add to the application's Gemfile by executing:
206
203
 
207
- $ bundle add oauth2
204
+ ```console
205
+ bundle add oauth2
206
+ ```
208
207
 
209
208
  If bundler is not being used to manage dependencies, install the gem by executing:
210
209
 
211
- $ gem install oauth2
210
+ ```console
211
+ gem install oauth2
212
+ ```
212
213
 
213
- ## OAuth2 for Enterprise
214
+ ### 🔒 Secure Installation
214
215
 
215
- Available as part of the Tidelift Subscription.
216
+ <details markdown="1">
217
+ <summary>For Medium or High Security Installations</summary>
216
218
 
217
- The maintainers of OAuth2 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]
219
+ This gem is cryptographically signed, and has verifiable [SHA-256 and SHA-512][💎SHA_checksums] checksums by
220
+ [stone_checksums][💎stone_checksums]. Be sure the gem you install hasn’t been tampered with
221
+ by following the instructions below.
218
222
 
219
- [tidelift-ref]: https://tidelift.com/subscription/pkg/rubygems-oauth2?utm_source=rubygems-oauth2&utm_medium=referral&utm_campaign=enterprise
223
+ Add my public key (if you haven’t already, expires 2045-04-29) as a trusted certificate:
220
224
 
221
- ## Security contact information
225
+ ```console
226
+ gem cert --add <(curl -Ls https://raw.github.com/galtzo-floss/certs/main/pboling.pem)
227
+ ```
222
228
 
223
- To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
224
- Tidelift will coordinate the fix and disclosure.
229
+ You only need to do that once. Then proceed to install with:
230
+
231
+ ```console
232
+ gem install oauth2 -P MediumSecurity
233
+ ```
234
+
235
+ The `MediumSecurity` trust profile will verify signed gems, but allow the installation of unsigned dependencies.
225
236
 
226
- For more see [SECURITY.md][🚎sec-pol].
237
+ This is necessary because not all of `oauth2`’s dependencies are signed, so we cannot use `HighSecurity`.
227
238
 
228
- ## Why should you upgrade to version v2.0?
239
+ If you want to up your security game full-time:
229
240
 
230
- - Officially support Ruby versions >= 2.7
231
- - Unofficially support Ruby versions >= 2.5
232
- - Incidentally support Ruby versions >= 2.2
241
+ ```console
242
+ bundle config set --global trust-policy MediumSecurity
243
+ ```
244
+
245
+ `MediumSecurity` instead of `HighSecurity` is necessary if not all the gems you use are signed.
246
+
247
+ NOTE: Be prepared to track down certs for signed gems and add them the same way you added mine.
248
+
249
+ </details>
250
+
251
+ ## What is new for v2.0?
252
+
253
+ - Works with Ruby versions >= 2.2
233
254
  - Drop support for the expired MAC Draft (all versions)
234
- - Support IETF rfc7523 JWT Bearer Tokens
235
- - Support IETF rfc7231 Relative Location in Redirect
236
- - Support IETF rfc6749 Don't set oauth params when nil
255
+ - Support IETF rfc7515 JSON Web Signature - JWS (since v2.0.12)
256
+ - Support JWT `kid` for key discovery and management
257
+ - Support IETF rfc7523 JWT Bearer Tokens (since v2.0.0)
258
+ - Support IETF rfc7231 Relative Location in Redirect (since v2.0.0)
259
+ - Support IETF rfc6749 Don't set oauth params when nil (since v2.0.0)
260
+ - Support IETF rfc7009 Token Revocation (since v2.0.10, updated in v2.0.13 to support revocation via URL-encoded parameters)
237
261
  - Support [OIDC 1.0 Private Key JWT](https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication); based on the OAuth JWT assertion specification [(RFC 7523)](https://tools.ietf.org/html/rfc7523)
238
262
  - Support new formats, including from [jsonapi.org](http://jsonapi.org/format/): `application/vdn.api+json`, `application/vnd.collection+json`, `application/hal+json`, `application/problem+json`
239
- - Adds new option to `OAuth2::Client#get_token`:
263
+ - Adds option to `OAuth2::Client#get_token`:
240
264
  - `:access_token_class` (`AccessToken`); user specified class to use for all calls to `get_token`
241
- - Adds new option to `OAuth2::AccessToken#initialize`:
265
+ - Adds option to `OAuth2::AccessToken#initialize`:
242
266
  - `:expires_latency` (`nil`); number of seconds by which AccessToken validity will be reduced to offset latency
243
- - By default, keys are transformed to camel case.
244
- - Original keys will still work as previously, in most scenarios, thanks to `rash_alt` gem.
245
- - However, this is a _breaking_ change if you rely on `response.parsed.to_h`, as the keys in the result will be camel case.
246
- - As of version 2.0.4 you can turn key transformation off with the `snaky: false` option.
267
+ - By default, keys are transformed to snake case.
268
+ - Original keys will still work as previously, in most scenarios, thanks to [snaky_hash][snaky_hash] gem.
269
+ - However, this is a _breaking_ change if you rely on `response.parsed.to_h` to retain the original case, and the original wasn't snake case, as the keys in the result will be snake case.
270
+ - As of version 2.0.4 you can turn key transformation off with the `snaky: false` option.
247
271
  - By default, the `:auth_scheme` is now `:basic_auth` (instead of `:request_body`)
248
- - Third-party strategies and gems may need to be updated if a provider was requiring client id/secret in the request body
249
- - [... A lot more](https://gitlab.com/oauth-xx/oauth2/-/blob/main/CHANGELOG.md#2.0.0)
272
+ - Third-party strategies and gems may need to be updated if a provider was requiring client id/secret in the request body
273
+ - [... A lot more](https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CHANGELOG.md#200-2022-06-21-tag)
274
+
275
+ [snaky_hash]: https://gitlab.com/ruby-oauth/snaky_hash
250
276
 
251
277
  ## Compatibility
252
278
 
253
- Targeted ruby compatibility is 2.7, 3.0 and 3.1. Compatibility is further distinguished by
254
- supported and unsupported versions of Ruby.
255
- This gem will work with Ruby versions back to 1.9, though it remains unsupported.
256
- Ruby is limited to 1.9+ in the gemspec for the 1.4.x series and is be 2.2+ for next major version releases (see `master` branch).
279
+ Targeted ruby compatibility is non-EOL versions of Ruby, currently 3.2, 3.3, and 3.4.
280
+ Compatibility is further distinguished as "Best Effort Support" or "Incidental Support" for older versions of Ruby.
281
+ This gem will install on Ruby versions >= v2.2 for 2.x releases.
282
+ See `1-4-stable` branch for older rubies.
257
283
 
258
- <details>
284
+ <details markdown="1">
259
285
  <summary>Ruby Engine Compatibility Policy</summary>
260
286
 
261
287
  This gem is tested against MRI, JRuby, and Truffleruby.
262
288
  Each of those has varying versions that target a specific version of MRI Ruby.
263
289
  This gem should work in the just-listed Ruby engines according to the targeted MRI compatibility in the table below.
264
290
  If you would like to add support for additional engines,
265
- see `gemfiles/README.md`, then submit a PR to the correct maintenance branch as according to the table below.
291
+ see [gemfiles/README.md](gemfiles/README.md), then submit a PR to the correct maintenance branch as according to the table below.
292
+
266
293
  </details>
267
294
 
268
- <details>
295
+ <details markdown="1">
269
296
  <summary>Ruby Version Compatibility Policy</summary>
270
297
 
271
298
  If something doesn't work on one of these interpreters, it's a bug.
272
299
 
273
300
  This library may inadvertently work (or seem to work) on other Ruby
274
- implementations, however support will only be provided for the versions listed
301
+ implementations; however, support will only be provided for the versions listed
275
302
  above.
276
303
 
277
304
  If you would like this library to support another Ruby version, you may
@@ -280,77 +307,330 @@ run and pass on that implementation. When something breaks on your
280
307
  implementation, you will be responsible for providing patches in a timely
281
308
  fashion. If critical issues for a particular implementation exist at the time
282
309
  of a major release, support for that Ruby version may be dropped.
310
+
283
311
  </details>
284
312
 
285
- | | Ruby OAuth2 Version | Maintenance Branch | Supported Officially | Supported Unofficially | Supported Incidentally |
286
- |:----|---------------------|--------------------|-------------------------|------------------------|------------------------|
287
- | 1️⃣ | 2.0.x | `main` | 2.7, 3.0, 3.1 | 2.5, 2.6 | 2.2, 2.3, 2.4 |
288
- | 2️⃣ | 1.4.x | `1-4-stable` | 2.5, 2.6, 2.7, 3.0, 3.1 | 2.1, 2.2, 2.3, 2.4 | 1.9, 2.0 |
289
- | 3️⃣ | older | N/A | Best of luck to you! | Please upgrade! | |
313
+ | | Ruby OAuth2 Version | Maintenance Branch | Targeted Support | Best Effort Support | Incidental Support |
314
+ |:----|---------------------|--------------------|----------------------|-------------------------|------------------------------|
315
+ | 1️⃣ | 2.0.x | `main` | 3.2, 3.3, 3.4 | 2.5, 2.6, 2.7, 3.0, 3.1 | 2.2, 2.3, 2.4 |
316
+ | 2️⃣ | 1.4.x | `1-4-stable` | 3.2, 3.3, 3.4 | 2.5, 2.6, 2.7, 3.0, 3.1 | 1.9, 2.0, 2.1, 2.2, 2.3, 2.4 |
317
+ | 3️⃣ | older | N/A | Best of luck to you! | Please upgrade! | |
290
318
 
291
319
  NOTE: The 1.4 series will only receive critical security updates.
292
- See [SECURITY.md][🚎sec-pol]
320
+ See [SECURITY.md][🔐security] and [IRP.md][🔐irp].
293
321
 
294
- ## Usage Examples
322
+ ## ⚙️ Configuration
323
+
324
+ Global settings for the library:
325
+
326
+ ```ruby
327
+ OAuth2.configure do |config|
328
+ config.silence_extra_tokens_warning = false # default: true
329
+ config.silence_no_tokens_warning = false # default: true
330
+ end
331
+ ```
332
+
333
+ Filtering-related settings:
295
334
 
296
335
  ```ruby
297
- require 'oauth2'
298
- client = OAuth2::Client.new('client_id', 'client_secret', :site => 'https://example.org')
336
+ OAuth2.configure do |config|
337
+ config.filtered_label = "[REDACTED]" # default: "[FILTERED]"
338
+ config.filtered_debug_keys += ["client_assertion"]
339
+ end
340
+ ```
341
+
342
+ - `filtered_label` controls the placeholder used when sensitive values are filtered from inspected objects and debug logging output.
343
+ - `filtered_debug_keys` controls which key names have their values redacted from debug logging output when `OAUTH_DEBUG=true`.
344
+ - Debug logging remains opt-in and should still be used cautiously in production environments.
345
+
346
+ ## 🔧 Basic Usage
347
+
348
+ ### Client Initialization Options
349
+
350
+ `OAuth2::Client.new` accepts several options:
351
+
352
+ - `:site`: The base URL for the OAuth 2.0 provider.
353
+ - `:authorize_url`: The authorization endpoint (default: `"oauth/authorize"`).
354
+ - `:token_url`: The token endpoint (default: `"oauth/token"`).
355
+ - `:auth_scheme`: The authentication scheme (`:basic_auth`, `:request_body`, `:tls_client_auth`, `:private_key_jwt`). Default is `:basic_auth`.
356
+ - `:connection_opts`: Options for the underlying Faraday connection (timeouts, proxy, etc.).
357
+ - `:raise_errors`: Whether to raise `OAuth2::Error` on 400+ responses (default: `true`).
299
358
 
300
- client.auth_code.authorize_url(:redirect_uri => 'http://localhost:8080/oauth2/callback')
301
- # => "https://example.org/oauth/authorization?response_type=code&client_id=client_id&redirect_uri=http://localhost:8080/oauth2/callback"
359
+ <details markdown="1">
360
+ <summary><em>authorize_url</em> and <em>token_url</em></summary>
302
361
 
303
- token = client.auth_code.get_token('authorization_code_value', :redirect_uri => 'http://localhost:8080/oauth2/callback', :headers => {'Authorization' => 'Basic some_password'})
304
- response = token.get('/api/resource', :params => {'query_foo' => 'bar'})
362
+ ### `authorize_url` and `token_url` are on site root (Just Works!)
363
+
364
+ ```ruby
365
+ require "oauth2"
366
+ client = OAuth2::Client.new("client_id", "client_secret", site: "https://example.org")
367
+ # => #<OAuth2::Client:0x00000001204c8288 @id="client_id", @secret="client_sec...
368
+ client.auth_code.authorize_url(redirect_uri: "http://localhost:8080/oauth2/callback")
369
+ # => "https://example.org/oauth/authorize?client_id=client_id&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Foauth2%2Fcallback&response_type=code"
370
+
371
+ access = client.auth_code.get_token("authorization_code_value", redirect_uri: "http://localhost:8080/oauth2/callback", headers: {"Authorization" => "Basic some_password"})
372
+ response = access.get("/api/resource", params: {"query_foo" => "bar"})
305
373
  response.class.name
306
374
  # => OAuth2::Response
307
375
  ```
308
376
 
309
- <details>
310
- <summary>Debugging</summary>
377
+ ### Relative `authorize_url` and `token_url` (Not on site root, Just Works!)
378
+
379
+ In the above example, the default Authorization URL is `oauth/authorize` and default Access Token URL is `oauth/token`, and, as they are missing a leading `/`, both are relative.
380
+
381
+ ```ruby
382
+ client = OAuth2::Client.new("client_id", "client_secret", site: "https://example.org/nested/directory/on/your/server")
383
+ # => #<OAuth2::Client:0x00000001204c8288 @id="client_id", @secret="client_sec...
384
+ client.auth_code.authorize_url(redirect_uri: "http://localhost:8080/oauth2/callback")
385
+ # => "https://example.org/nested/directory/on/your/server/oauth/authorize?client_id=client_id&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Foauth2%2Fcallback&response_type=code"
386
+ ```
387
+
388
+ ### Customize `authorize_url` and `token_url`
389
+
390
+ You can specify custom URLs for authorization and access token, and when using a leading `/` they will _not be relative_, as shown below:
391
+
392
+ ```ruby
393
+ client = OAuth2::Client.new(
394
+ "client_id",
395
+ "client_secret",
396
+ site: "https://example.org/nested/directory/on/your/server",
397
+ authorize_url: "/jaunty/authorize/",
398
+ token_url: "/stirrups/access_token",
399
+ )
400
+ # => #<OAuth2::Client:0x00000001204c8288 @id="client_id", @secret="client_sec...
401
+ client.auth_code.authorize_url(redirect_uri: "http://localhost:8080/oauth2/callback")
402
+ # => "https://example.org/jaunty/authorize/?client_id=client_id&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Foauth2%2Fcallback&response_type=code"
403
+ client.class.name
404
+ # => OAuth2::Client
405
+ ```
406
+
407
+ </details>
408
+
409
+ ### Advanced Initializers
410
+
411
+ ```ruby
412
+ client = OAuth2::Client.new(id, secret, site: site) do |faraday|
413
+ faraday.request(:url_encoded)
414
+ faraday.adapter(:net_http_persistent)
415
+ end
416
+ ```
417
+
418
+ ### AccessToken Features
311
419
 
312
- Set an environment variable, however you would [normally do that](https://github.com/bkeepers/dotenv).
420
+ Instances of `OAuth2::AccessToken` handle request signing and token expiration.
421
+
422
+ - **Snake Case & Indifferent Access**: `response.parsed` returns a `SnakyHash` allowing access via string/symbol and snake_case keys even if the provider returns CamelCase.
423
+ - **Auto-Refresh**: You can manually check `token.expired?` and call `token.refresh`.
424
+ - **Serialization**: Persist tokens using `token.to_hash` and restore via `OAuth2::AccessToken.from_hash(client, hash)`.
425
+
426
+ ### snake_case and indifferent access in Response#parsed
427
+
428
+ ```ruby
429
+ response = access.get("/api/resource", params: {"query_foo" => "bar"})
430
+ # Even if the actual response is CamelCase. it will be made available as snaky:
431
+ JSON.parse(response.body) # => {"accessToken"=>"aaaaaaaa", "additionalData"=>"additional"}
432
+ response.parsed # => {"access_token"=>"aaaaaaaa", "additional_data"=>"additional"}
433
+ response.parsed.access_token # => "aaaaaaaa"
434
+ response.parsed[:access_token] # => "aaaaaaaa"
435
+ response.parsed.additional_data # => "additional"
436
+ response.parsed[:additional_data] # => "additional"
437
+ response.parsed.class.name # => SnakyHash::StringKeyed (from snaky_hash gem)
438
+ ```
439
+
440
+ #### Serialization
441
+
442
+ As of v2.0.11, if you need to serialize the parsed result, you can!
443
+
444
+ There are two ways to do this, globally, or discretely. The discrete way is recommended.
445
+
446
+ ##### Global Serialization Config
447
+
448
+ Globally configure `SnakyHash::StringKeyed` to use the serializer. Put this in your code somewhere reasonable (like an initializer for Rails).
449
+
450
+ ```ruby
451
+ SnakyHash::StringKeyed.class_eval do
452
+ extend SnakyHash::Serializer
453
+ end
454
+ ```
455
+
456
+ ##### Discrete Serialization Config
457
+
458
+ Discretely configure a custom Snaky Hash class to use the serializer.
459
+
460
+ ```ruby
461
+ class MySnakyHash < SnakyHash::StringKeyed
462
+ # Give this hash class `dump` and `load` abilities!
463
+ extend SnakyHash::Serializer
464
+ end
465
+
466
+ # And tell your client to use the custom class in each call:
467
+ client = OAuth2::Client.new("client_id", "client_secret", site: "https://example.org/oauth2")
468
+ token = client.get_token({snaky_hash_klass: MySnakyHash})
469
+ ```
470
+
471
+ ##### Serialization Extensions
472
+
473
+ These extensions work regardless of whether you used the global or discrete config above.
474
+
475
+ There are a few hacks you may need in your class to support Ruby < 2.4.2 or < 2.6.
476
+ They are likely not needed if you are on a newer Ruby.
477
+ Expand the examples below, or the [ruby-oauth/snaky_hash](https://gitlab.com/ruby-oauth/snaky_hash) gem,
478
+ or [response_spec.rb](https://github.com/ruby-oauth/oauth2/blob/main/spec/oauth2/response_spec.rb), for more ideas, especially if you need to study the hacks for older Rubies.
479
+
480
+ <details markdown="1">
481
+ <summary>See Examples</summary>
482
+
483
+ ```ruby
484
+ class MySnakyHash < SnakyHash::StringKeyed
485
+ # Give this hash class `dump` and `load` abilities!
486
+ extend SnakyHash::Serializer
487
+
488
+ #### Serialization Extentions
489
+ #
490
+ # Act on the non-hash values (including the values of hashes) as they are dumped to JSON
491
+ # In other words, this retains nested hashes, and only the deepest leaf nodes become bananas.
492
+ # WARNING: This is a silly example!
493
+ dump_value_extensions.add(:to_fruit) do |value|
494
+ "banana" # => Make values "banana" on dump
495
+ end
496
+
497
+ # Act on the non-hash values (including the values of hashes) as they are loaded from the JSON dump
498
+ # In other words, this retains nested hashes, and only the deepest leaf nodes become ***.
499
+ # WARNING: This is a silly example!
500
+ load_value_extensions.add(:to_stars) do |value|
501
+ "***" # Turn dumped bananas into *** when they are loaded
502
+ end
503
+
504
+ # Act on the entire hash as it is prepared for dumping to JSON
505
+ # WARNING: This is a silly example!
506
+ dump_hash_extensions.add(:to_cheese) do |value|
507
+ if value.is_a?(Hash)
508
+ value.transform_keys do |key|
509
+ split = key.split("_")
510
+ first_word = split[0]
511
+ key.sub(first_word, "cheese")
512
+ end
513
+ else
514
+ value
515
+ end
516
+ end
517
+
518
+ # Act on the entire hash as it is loaded from the JSON dump
519
+ # WARNING: This is a silly example!
520
+ load_hash_extensions.add(:to_pizza) do |value|
521
+ if value.is_a?(Hash)
522
+ res = klass.new
523
+ value.keys.each_with_object(res) do |key, result|
524
+ split = key.split("_")
525
+ last_word = split[-1]
526
+ new_key = key.sub(last_word, "pizza")
527
+ result[new_key] = value[key]
528
+ end
529
+ res
530
+ else
531
+ value
532
+ end
533
+ end
534
+ end
535
+ ```
536
+
537
+ </details>
538
+
539
+ #### Prefer camelCase over snake_case? => snaky: false
540
+
541
+ ```ruby
542
+ response = access.get("/api/resource", params: {"query_foo" => "bar"}, snaky: false)
543
+ JSON.parse(response.body) # => {"accessToken"=>"aaaaaaaa", "additionalData"=>"additional"}
544
+ response.parsed # => {"accessToken"=>"aaaaaaaa", "additionalData"=>"additional"}
545
+ response.parsed["accessToken"] # => "aaaaaaaa"
546
+ response.parsed["additionalData"] # => "additional"
547
+ response.parsed.class.name # => Hash (just, regular old Hash)
548
+ ```
549
+
550
+ <details markdown="1">
551
+ <summary>Debugging & Logging</summary>
552
+
553
+ Set an environment variable as per usual (e.g. with [dotenv](https://github.com/bkeepers/dotenv)).
313
554
 
314
555
  ```ruby
315
556
  # will log both request and response, including bodies
316
- ENV['OAUTH_DEBUG'] = 'true'
557
+ ENV["OAUTH_DEBUG"] = "true"
317
558
  ```
318
559
 
319
560
  By default, debug output will go to `$stdout`. This can be overridden when
320
561
  initializing your OAuth2::Client.
321
562
 
563
+ Sensitive values are filtered from debug logging output using:
564
+
565
+ - `OAuth2.config[:filtered_label]`
566
+ - `OAuth2.config[:filtered_debug_keys]`
567
+
568
+ Debug logging remains opt-in and should still be used cautiously in production environments.
569
+
322
570
  ```ruby
323
- require 'oauth2'
571
+ require "oauth2"
324
572
  client = OAuth2::Client.new(
325
- 'client_id',
326
- 'client_secret',
327
- :site => 'https://example.org',
328
- :logger => Logger.new('example.log', 'weekly')
573
+ "client_id",
574
+ "client_secret",
575
+ site: "https://example.org",
576
+ logger: Logger.new("example.log", "weekly"),
329
577
  )
330
578
  ```
579
+
331
580
  </details>
332
581
 
333
- ## OAuth2::Response
582
+ ### Request Target Trust Boundaries
583
+
584
+ This gem supports request flows that can involve absolute URLs in addition to relative paths.
585
+ That flexibility can expand trust boundaries when a token-bearing client is asked to send requests
586
+ to caller-provided targets.
587
+
588
+ Practical guidance:
589
+
590
+ - prefer relative paths where practical
591
+ - do not pass untrusted absolute URLs into token-bearing clients
592
+ - validate or allowlist request targets at the application layer today if your deployment has strict trust-boundary requirements
593
+
594
+ This release line does not yet enforce same-host or allowlist request policy automatically.
595
+ If stricter outbound request controls are needed, they should currently be implemented by the calling application.
596
+
597
+ ### OAuth2::Response
334
598
 
335
599
  The `AccessToken` methods `#get`, `#post`, `#put` and `#delete` and the generic `#request`
336
- will return an instance of the #OAuth2::Response class.
600
+ will return an instance of the `OAuth2::Response` class.
337
601
 
338
602
  This instance contains a `#parsed` method that will parse the response body and
339
- return a Hash if the `Content-Type` is `application/x-www-form-urlencoded` or if
340
- the body is a JSON object. It will return an Array if the body is a JSON
341
- array. Otherwise, it will return the original body string.
603
+ return a Hash-like [`SnakyHash::StringKeyed`](https://gitlab.com/ruby-oauth/snaky_hash/-/blob/main/lib/snaky_hash/string_keyed.rb) if the `Content-Type` is `application/x-www-form-urlencoded` or if
604
+ the body is a JSON object. It will return an Array if the body is a JSON
605
+ array. Otherwise, it will return the original body string.
342
606
 
343
607
  The original response body, headers, and status can be accessed via their
344
608
  respective methods.
345
609
 
346
- ## OAuth2::AccessToken
610
+ ### OAuth2::AccessToken
347
611
 
348
612
  If you have an existing Access Token for a user, you can initialize an instance
349
613
  using various class methods including the standard new, `from_hash` (if you have
350
614
  a hash of the values), or `from_kvform` (if you have an
351
615
  `application/x-www-form-urlencoded` encoded string of the values).
352
616
 
353
- ## OAuth2::Error
617
+ Options (since v2.0.x unless noted):
618
+
619
+ - `expires_latency` (Integer | nil): Seconds to subtract from expires_in when computing #expired? to offset latency.
620
+ - `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).
621
+ - `mode` (Symbol | Proc | Hash): Controls how the token is transmitted on requests made via this AccessToken instance.
622
+ - `:header` — Send as Authorization: Bearer <token> header (default and preferred by OAuth 2.1 draft guidance).
623
+ - `:query` — Send as access_token query parameter (discouraged in general, but required by some providers).
624
+ - Verb-dependent (since v2.0.15): Provide either:
625
+ - a `Proc` taking `|verb|` and returning `:header` or `:query`, or
626
+ - a `Hash` with verb symbols as keys, for example `{get: :query, post: :header, delete: :header}`.
627
+
628
+ Note: Verb-dependent mode supports providers like Instagram that require query mode for `GET` and header mode for `POST`/`DELETE`
629
+
630
+ - Verb-dependent mode via `Proc` was added in v2.0.15
631
+ - Verb-dependent mode via `Hash` was added in v2.0.16
632
+
633
+ ### OAuth2::Error
354
634
 
355
635
  On 400+ status code responses, an `OAuth2::Error` will be raised. If it is a
356
636
  standard OAuth2 error response, the body will be parsed and `#code` and `#description` will contain the values provided from the error and
@@ -362,90 +642,909 @@ option on initialization of the client. In this case the `OAuth2::Response`
362
642
  instance will be returned as usual and on 400+ status code responses, the
363
643
  Response instance will contain the `OAuth2::Error` instance.
364
644
 
365
- ## Authorization Grants
645
+ ### Authorization Grants
366
646
 
367
- Currently the Authorization Code, Implicit, Resource Owner Password Credentials, Client Credentials, and Assertion
647
+ Currently, the Authorization Code, Implicit, Resource Owner Password Credentials, Client Credentials, and Assertion
368
648
  authentication grant types have helper strategy classes that simplify client
369
- use. They are available via the `#auth_code`, `#implicit`, `#password`, `#client_credentials`, and `#assertion` methods respectively.
649
+ use. They are available via the [`#auth_code`](https://gitlab.com/ruby-oauth/oauth2/-/blob/main/lib/oauth2/strategy/auth_code.rb),
650
+ [`#implicit`](https://gitlab.com/ruby-oauth/oauth2/-/blob/main/lib/oauth2/strategy/implicit.rb),
651
+ [`#password`](https://gitlab.com/ruby-oauth/oauth2/-/blob/main/lib/oauth2/strategy/password.rb),
652
+ [`#client_credentials`](https://gitlab.com/ruby-oauth/oauth2/-/blob/main/lib/oauth2/strategy/client_credentials.rb), and
653
+ [`#assertion`](https://gitlab.com/ruby-oauth/oauth2/-/blob/main/lib/oauth2/strategy/assertion.rb) methods respectively.
370
654
 
371
- ```ruby
372
- auth_url = client.auth_code.authorize_url(:redirect_uri => 'http://localhost:8080/oauth/callback')
373
- token = client.auth_code.get_token('code_value', :redirect_uri => 'http://localhost:8080/oauth/callback')
655
+ #### OAuth 2.1 (draft) Note:
374
656
 
375
- auth_url = client.implicit.authorize_url(:redirect_uri => 'http://localhost:8080/oauth/callback')
376
- # get the token params in the callback and
377
- token = OAuth2::AccessToken.from_kvform(client, query_string)
657
+ - **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.
658
+ - **Implicit grant** (response_type=token) and **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.
659
+ - **Redirect URIs** must be compared using exact string matching by the Authorization Server.
660
+
661
+ <details markdown="1">
662
+ <summary>OAuth 2.1 (draft) References</summary>
378
663
 
379
- token = client.password.get_token('username', 'password')
664
+ - OAuth 2.1 draft: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-13
665
+ - Aaron Parecki: https://aaronparecki.com/2019/12/12/21/its-time-for-oauth-2-dot-1
666
+ - FusionAuth: https://fusionauth.io/blog/2020/04/15/whats-new-in-oauth-2-1
667
+ - Okta: https://developer.okta.com/blog/2019/12/13/oauth-2-1-how-many-rfcs
668
+ - Video: https://www.youtube.com/watch?v=g_aVPdwBTfw
669
+ - Differences overview: https://fusionauth.io/learn/expert-advice/oauth/differences-between-oauth-2-oauth-2-1/
380
670
 
381
- token = client.client_credentials.get_token
671
+ </details>
672
+
673
+ These aren't full examples, but demonstrative of the differences between usage for each strategy.
674
+
675
+ ```ruby
676
+ auth_url = client.auth_code.authorize_url(redirect_uri: "http://localhost:8080/oauth/callback")
677
+ access = client.auth_code.get_token("code_value", redirect_uri: "http://localhost:8080/oauth/callback")
382
678
 
383
- token = client.assertion.get_token(assertion_params)
679
+ auth_url = client.implicit.authorize_url(redirect_uri: "http://localhost:8080/oauth/callback")
680
+ # get the token params in the callback and
681
+ access = OAuth2::AccessToken.from_kvform(client, query_string)
682
+
683
+ access = client.password.get_token("username", "password")
684
+
685
+ access = client.client_credentials.get_token
686
+
687
+ # Client Assertion Strategy
688
+ # see: https://tools.ietf.org/html/rfc7523
689
+ claimset = {
690
+ iss: "http://localhost:3001",
691
+ aud: "http://localhost:8080/oauth2/token",
692
+ sub: "me@example.com",
693
+ exp: Time.now.utc.to_i + 3600,
694
+ }
695
+ assertion_params = [claimset, "HS256", "secret_key"]
696
+ access = client.assertion.get_token(assertion_params)
697
+
698
+ # The `access` (i.e. access token) is then used like so:
699
+ access.token # actual access_token string, if you need it somewhere
700
+ access.get("/api/stuff") # making api calls with access token
384
701
  ```
385
702
 
386
703
  If you want to specify additional headers to be sent out with the
387
704
  request, add a 'headers' hash under 'params':
388
705
 
389
706
  ```ruby
390
- token = client.auth_code.get_token('code_value', :redirect_uri => 'http://localhost:8080/oauth/callback', :headers => {'Some' => 'Header'})
707
+ access = client.auth_code.get_token("code_value", redirect_uri: "http://localhost:8080/oauth/callback", headers: {"Some" => "Header"})
391
708
  ```
392
709
 
393
710
  You can always use the `#request` method on the `OAuth2::Client` instance to make
394
711
  requests for tokens for any Authentication grant type.
395
712
 
396
- ## Versioning
713
+ ## 📘 Comprehensive Usage
714
+
715
+ ### Common Flows (end-to-end)
716
+
717
+ - Authorization Code (server-side web app):
718
+
719
+ ```ruby
720
+ require "oauth2"
721
+ client = OAuth2::Client.new(
722
+ ENV["CLIENT_ID"],
723
+ ENV["CLIENT_SECRET"],
724
+ site: "https://provider.example.com",
725
+ redirect_uri: "https://my.app.example.com/oauth/callback",
726
+ )
727
+
728
+ # Step 1: redirect user to consent
729
+ state = SecureRandom.hex(16)
730
+ auth_url = client.auth_code.authorize_url(scope: "openid profile email", state: state)
731
+ # redirect_to auth_url
732
+
733
+ # Step 2: handle the callback
734
+ # params[:code], params[:state]
735
+ raise "state mismatch" unless params[:state] == state
736
+ access = client.auth_code.get_token(params[:code])
737
+
738
+ # Step 3: call APIs
739
+ profile = access.get("/api/v1/me").parsed
740
+ ```
741
+
742
+ - Client Credentials (machine-to-machine):
743
+
744
+ ```ruby
745
+ client = OAuth2::Client.new(ENV["CLIENT_ID"], ENV["CLIENT_SECRET"], site: "https://provider.example.com")
746
+ access = client.client_credentials.get_token(audience: "https://api.example.com")
747
+ resp = access.get("/v1/things")
748
+ ```
749
+
750
+ - Resource Owner Password (legacy; avoid when possible):
751
+
752
+ ```ruby
753
+ access = client.password.get_token("jdoe", "s3cret", scope: "read")
754
+ ```
397
755
 
398
- This library aims to adhere to [Semantic Versioning 2.0.0][semver].
399
- Violations of this scheme should be reported as bugs. Specifically,
400
- if a minor or patch version is released that breaks backward
401
- compatibility, a new version should be immediately released that
402
- restores compatibility. Breaking changes to the public API will
403
- only be introduced with new major versions.
756
+ #### Examples
404
757
 
405
- As a result of this policy, you can (and should) specify a
406
- dependency on this gem using the [Pessimistic Version Constraint][pvc] with two digits of precision.
758
+ <details markdown="1">
759
+ <summary>JHipster UAA (Spring Cloud) password grant example (legacy; avoid when possible)</summary>
760
+
761
+ ```ruby
762
+ # This converts a Postman/Net::HTTP multipart token request to oauth2 gem usage.
763
+ # JHipster UAA typically exposes the token endpoint at /uaa/oauth/token.
764
+ # The original snippet included:
765
+ # - Basic Authorization header for the client (web_app:changeit)
766
+ # - X-XSRF-TOKEN header from a cookie (some deployments require it)
767
+ # - grant_type=password with username/password and client_id
768
+ # Using oauth2 gem, you don't need to build multipart bodies; the gem sends
769
+ # application/x-www-form-urlencoded as required by RFC 6749.
770
+
771
+ require "oauth2"
772
+
773
+ client = OAuth2::Client.new(
774
+ "web_app", # client_id
775
+ "changeit", # client_secret
776
+ site: "http://localhost:8080/uaa",
777
+ token_url: "/oauth/token", # absolute under site (or "oauth/token" relative)
778
+ auth_scheme: :basic_auth, # sends HTTP Basic Authorization header
779
+ )
780
+
781
+ # If your UAA requires an XSRF header for the token call, provide it as a header.
782
+ # Often this is not required for token endpoints, but if your gateway enforces it,
783
+ # obtain the value from the XSRF-TOKEN cookie and pass it here.
784
+ xsrf_token = ENV["X_XSRF_TOKEN"] # e.g., pulled from a prior set-cookie value
785
+
786
+ access = client.password.get_token(
787
+ "admin", # username
788
+ "admin", # password
789
+ headers: xsrf_token ? {"X-XSRF-TOKEN" => xsrf_token} : {},
790
+ # JHipster commonly also accepts/needs the client_id in the body; include if required:
791
+ # client_id: "web_app",
792
+ )
793
+
794
+ puts access.token
795
+ puts access.to_hash # full token response
796
+ ```
797
+
798
+ Notes:
799
+
800
+ - Resource Owner Password Credentials (ROPC) is deprecated in OAuth 2.1 and discouraged. Prefer Authorization Code + PKCE.
801
+ - 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.
802
+ - For Basic auth, auth_scheme: :basic_auth handles the Authorization header; you do not need to base64-encode manually.
803
+
804
+ </details>
805
+
806
+ ### Verb‑dependent Token Mode
807
+
808
+ Providers like Instagram require the access token to be sent differently depending on the HTTP verb:
809
+
810
+ - GET requests: token must be in the query string (?access_token=...)
811
+ - POST/DELETE requests: token must be in the Authorization header (Bearer ...)
812
+
813
+ 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.
814
+
815
+ Tips:
816
+
817
+ - Avoid query‑string bearer tokens unless required by your provider. Instagram explicitly requires it for `GET` requests.
818
+ - If you need a custom rule, you can pass a `Proc` for `mode`, e.g. `mode: ->(verb) { verb == :get ? :query : :header }`.
819
+
820
+ <details markdown="1">
821
+ <summary>Instagram API Example</summary>
822
+
823
+ Example: exchanging and refreshing long‑lived Instagram tokens, and making API calls
824
+
825
+ ```ruby
826
+ require "oauth2"
827
+
828
+ # NOTE: Users authenticate via Facebook Login to obtain a short‑lived user token (not shown here).
829
+ # See Facebook Login docs for obtaining the initial short‑lived token.
830
+
831
+ client = OAuth2::Client.new(nil, nil, site: "https://graph.instagram.com")
832
+
833
+ # Start with a short‑lived token you already obtained via Facebook Login
834
+ short_lived = OAuth2::AccessToken.new(
835
+ client,
836
+ ENV["IG_SHORT_LIVED_TOKEN"],
837
+ # Key part: verb‑dependent mode
838
+ mode: {get: :query, post: :header, delete: :header},
839
+ )
840
+
841
+ # 1) Exchange for a long‑lived token (Instagram requires GET with access_token in query)
842
+ # Endpoint: GET https://graph.instagram.com/access_token
843
+ # Params: grant_type=ig_exchange_token, client_secret=APP_SECRET
844
+ exchange = short_lived.get(
845
+ "/access_token",
846
+ params: {
847
+ grant_type: "ig_exchange_token",
848
+ client_secret: ENV["IG_APP_SECRET"],
849
+ # access_token param will be added automatically by the AccessToken (mode => :query for GET)
850
+ },
851
+ )
852
+ long_lived_token_value = exchange.parsed["access_token"]
853
+
854
+ long_lived = OAuth2::AccessToken.new(
855
+ client,
856
+ long_lived_token_value,
857
+ mode: {get: :query, post: :header, delete: :header},
858
+ )
859
+
860
+ # 2) Refresh the long‑lived token (Instagram uses GET with token in query)
861
+ # Endpoint: GET https://graph.instagram.com/refresh_access_token
862
+ refresh_resp = long_lived.get(
863
+ "/refresh_access_token",
864
+ params: {grant_type: "ig_refresh_token"},
865
+ )
866
+ long_lived = OAuth2::AccessToken.new(
867
+ client,
868
+ refresh_resp.parsed["access_token"],
869
+ mode: {get: :query, post: :header, delete: :header},
870
+ )
871
+
872
+ # 3) Typical API GET request (token in query automatically)
873
+ me = long_lived.get("/me", params: {fields: "id,username"}).parsed
874
+
875
+ # 4) Example POST (token sent via Bearer header automatically)
876
+ # Note: Replace the path/params with a real Instagram Graph API POST you need,
877
+ # such as publishing media via the Graph API endpoints.
878
+ # long_lived.post("/me/media", body: {image_url: "https://...", caption: "hello"})
879
+ ```
880
+
881
+ </details>
882
+
883
+ ### Refresh Tokens
884
+
885
+ When the server issues a refresh_token, you can refresh manually or implement an auto-refresh wrapper.
886
+
887
+ - Manual refresh:
888
+
889
+ ```ruby
890
+ if access.expired?
891
+ access = access.refresh
892
+ end
893
+ ```
894
+
895
+ - Auto-refresh wrapper pattern:
896
+
897
+ ```ruby
898
+ class AutoRefreshingToken
899
+ def initialize(token_provider, store: nil)
900
+ @token = token_provider
901
+ @store = store # e.g., something that responds to read/write for token data
902
+ end
903
+
904
+ def with(&blk)
905
+ tok = ensure_fresh!
906
+ blk ? blk.call(tok) : tok
907
+ rescue OAuth2::Error => e
908
+ # If a 401 suggests token invalidation, try one refresh and retry once
909
+ if e.response && e.response.status == 401 && @token.refresh_token
910
+ @token = @token.refresh
911
+ @store.write(@token.to_hash) if @store
912
+ retry
913
+ end
914
+ raise
915
+ end
916
+
917
+ private
918
+
919
+ def ensure_fresh!
920
+ if @token.expired? && @token.refresh_token
921
+ @token = @token.refresh
922
+ @store.write(@token.to_hash) if @store
923
+ end
924
+ @token
925
+ end
926
+ end
927
+
928
+ # usage
929
+ keeper = AutoRefreshingToken.new(access)
930
+ keeper.with { |tok| tok.get("/v1/protected") }
931
+ ```
932
+
933
+ Persist the token across processes using `AccessToken#to_hash` and `AccessToken.from_hash(client, hash)`.
934
+
935
+ ### Token Revocation (RFC 7009)
936
+
937
+ You can revoke either the access token or the refresh token.
938
+
939
+ ```ruby
940
+ # Revoke the current access token
941
+ access.revoke(token_type_hint: :access_token)
942
+
943
+ # Or explicitly revoke the refresh token (often also invalidates associated access tokens)
944
+ access.revoke(token_type_hint: :refresh_token)
945
+ ```
946
+
947
+ ### Client Configuration Tips
948
+
949
+ #### Mutual TLS (mTLS) client authentication
950
+
951
+ 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.
952
+
953
+ Example using PEM files (certificate and key):
954
+
955
+ ```ruby
956
+ require "oauth2"
957
+ require "openssl"
958
+
959
+ client = OAuth2::Client.new(
960
+ ENV.fetch("CLIENT_ID"),
961
+ ENV.fetch("CLIENT_SECRET"),
962
+ site: "https://example.com",
963
+ authorize_url: "/oauth/authorize/",
964
+ token_url: "/oauth/token/",
965
+ auth_scheme: :tls_client_auth, # if your AS requires mTLS-based client authentication
966
+ connection_opts: {
967
+ ssl: {
968
+ client_cert: OpenSSL::X509::Certificate.new(File.read("localhost.pem")),
969
+ client_key: OpenSSL::PKey::RSA.new(File.read("localhost-key.pem")),
970
+ # Optional extras, uncomment as needed:
971
+ # ca_file: "/path/to/ca-bundle.pem", # custom CA(s)
972
+ # verify: true # enable server cert verification (recommended)
973
+ },
974
+ },
975
+ )
976
+
977
+ # Example token request (any grant type can be used). The mTLS handshake
978
+ # will occur automatically on HTTPS calls using the configured cert/key.
979
+ access = client.client_credentials.get_token
980
+
981
+ # Subsequent resource requests will also use mTLS on HTTPS endpoints of `site`:
982
+ resp = access.get("/v1/protected")
983
+ ```
984
+
985
+ Notes:
986
+
987
+ - 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"])`.
988
+ - If your certificate and key are in a PKCS#12/PFX bundle, you can load them like:
989
+ - `p12 = OpenSSL::PKCS12.new(File.read("client.p12"), ENV["P12_PASSWORD"])`
990
+ - `client_cert = p12.certificate; client_key = p12.key`
991
+ - Server trust:
992
+ - If your environment does not have system CAs, specify `ca_file` or `ca_path` inside the `ssl:` hash.
993
+ - Keep `verify: true` in production. Set `verify: false` only for local testing.
994
+ - Faraday adapter: Any adapter that supports Ruby’s OpenSSL should work. `net_http` (default) and `net_http_persistent` are common choices.
995
+ - 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).
996
+ - 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.
997
+
998
+ #### Authentication schemes for the token request
999
+
1000
+ ```ruby
1001
+ OAuth2::Client.new(
1002
+ id,
1003
+ secret,
1004
+ site: "https://provider.example.com",
1005
+ auth_scheme: :basic_auth, # default. Alternatives: :request_body, :tls_client_auth, :private_key_jwt
1006
+ )
1007
+ ```
1008
+
1009
+ #### Faraday connection, timeouts, proxy, custom adapter/middleware:
1010
+
1011
+ ```ruby
1012
+ client = OAuth2::Client.new(
1013
+ id,
1014
+ secret,
1015
+ site: "https://provider.example.com",
1016
+ connection_opts: {
1017
+ request: {open_timeout: 5, timeout: 15},
1018
+ proxy: ENV["HTTPS_PROXY"],
1019
+ ssl: {verify: true},
1020
+ },
1021
+ ) do |faraday|
1022
+ faraday.request(:url_encoded)
1023
+ # faraday.response :logger, Logger.new($stdout) # see OAUTH_DEBUG below
1024
+ faraday.adapter(:net_http_persistent) # or any Faraday adapter you need
1025
+ end
1026
+ ```
1027
+
1028
+ ##### Using flat query params (`Faraday::FlatParamsEncoder`)
1029
+
1030
+ 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.
1031
+
1032
+ ```ruby
1033
+ require "faraday"
1034
+
1035
+ client = OAuth2::Client.new(
1036
+ id,
1037
+ secret,
1038
+ site: "https://api.example.com",
1039
+ # Pass Faraday connection options to make FlatParamsEncoder the default
1040
+ connection_opts: {
1041
+ request: {params_encoder: Faraday::FlatParamsEncoder},
1042
+ },
1043
+ ) do |faraday|
1044
+ faraday.request(:url_encoded)
1045
+ faraday.adapter(:net_http)
1046
+ end
1047
+
1048
+ access = client.client_credentials.get_token
1049
+
1050
+ # Example of a GET with two flat filter params (not an array):
1051
+ # Results in: ?filter=order.clientCreatedTime%3E1445006997000&filter=order.clientCreatedTime%3C1445611797000
1052
+ resp = access.get(
1053
+ "/v1/orders",
1054
+ params: {
1055
+ # Provide the values as an array; FlatParamsEncoder expands them as repeated keys
1056
+ filter: [
1057
+ "order.clientCreatedTime>1445006997000",
1058
+ "order.clientCreatedTime<1445611797000",
1059
+ ],
1060
+ },
1061
+ )
1062
+ ```
1063
+
1064
+ If you instead need to build a raw Faraday connection yourself, the equivalent configuration is:
1065
+
1066
+ ```ruby
1067
+ conn = Faraday.new("https://api.example.com", request: {params_encoder: Faraday::FlatParamsEncoder})
1068
+ ```
1069
+
1070
+ #### Redirection
1071
+
1072
+ The library follows up to `max_redirects` (default 5).
1073
+ You can override per-client via `options[:max_redirects]`.
1074
+
1075
+ ### Handling Responses and Errors
1076
+
1077
+ - Parsing:
1078
+
1079
+ ```ruby
1080
+ resp = access.get("/v1/thing")
1081
+ resp.status # Integer
1082
+ resp.headers # Hash
1083
+ resp.body # String
1084
+ resp.parsed # SnakyHash::StringKeyed or Array when JSON array
1085
+ ```
1086
+
1087
+ - Error handling:
1088
+
1089
+ ```ruby
1090
+ begin
1091
+ access.get("/v1/forbidden")
1092
+ rescue OAuth2::Error => e
1093
+ e.code # OAuth2 error code (when present)
1094
+ e.description # OAuth2 error description (when present)
1095
+ e.response # OAuth2::Response (full access to status/headers/body)
1096
+ end
1097
+ ```
1098
+
1099
+ - Disable raising on 4xx/5xx to inspect the response yourself:
1100
+
1101
+ ```ruby
1102
+ client = OAuth2::Client.new(id, secret, site: site, raise_errors: false)
1103
+ res = client.request(:get, "/v1/maybe-errors")
1104
+ if res.status == 429
1105
+ sleep res.headers["retry-after"].to_i
1106
+ end
1107
+ ```
1108
+
1109
+ ### Making Raw Token Requests
1110
+
1111
+ If a provider requires non-standard parameters or headers, you can call `client.get_token` directly:
1112
+
1113
+ ```ruby
1114
+ access = client.get_token({
1115
+ grant_type: "client_credentials",
1116
+ audience: "https://api.example.com",
1117
+ headers: {"X-Custom" => "value"},
1118
+ parse: :json, # override parsing
1119
+ })
1120
+ ```
1121
+
1122
+ ### OpenID Connect (OIDC)
1123
+
1124
+ - If the token response includes an `id_token` (a JWT), this gem surfaces it in `token.params['id_token']`.
1125
+ - **Note**: This gem does **not** validate the signature of the `id_token`. You must use a JWT library (like the `jwt` [gem](https://github.com/jwt/ruby-jwt)) and your provider's JWKs to verify it.
1126
+ - For `private_key_jwt` client authentication, provide `auth_scheme: :private_key_jwt` and ensure your key configuration matches the provider requirements.
1127
+ - See [OIDC.md](OIDC.md) for a more complete OIDC overview and examples.
1128
+
1129
+ ### Debugging
1130
+
1131
+ - Set environment variable `OAUTH_DEBUG=true` to enable verbose Faraday logging (uses the client-provided logger).
1132
+ - To mirror a working curl request, ensure you set the same auth scheme, params, and content type. The Quick Example at the top shows a curl-to-ruby translation.
1133
+
1134
+ ---
1135
+
1136
+ ## 🦷 FLOSS Funding
1137
+
1138
+ While ruby-oauth tools are free software and will always be, the project would benefit immensely from some funding.
1139
+ Raising a monthly budget of... "dollars" would make the project more sustainable.
1140
+
1141
+ We welcome both individual and corporate sponsors! We also offer a
1142
+ wide array of funding channels to account for your preferences
1143
+ (although currently [Open Collective][🖇osc] is our preferred funding platform).
1144
+
1145
+ **If you're working in a company that's making significant use of ruby-oauth tools we'd
1146
+ appreciate it if you suggest to your company to become a ruby-oauth sponsor.**
1147
+
1148
+ You can support the development of ruby-oauth tools via
1149
+ [GitHub Sponsors][🖇sponsor],
1150
+ [Liberapay][⛳liberapay],
1151
+ [PayPal][🖇paypal],
1152
+ [Open Collective][🖇osc]
1153
+ and [Tidelift][🏙️entsup-tidelift].
1154
+
1155
+ | 📍 NOTE |
1156
+ |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1157
+ | If doing a sponsorship in the form of donation is problematic for your company <br/> from an accounting standpoint, we'd recommend the use of Tidelift, <br/> where you can get a support-like subscription instead. |
1158
+
1159
+ ### Open Collective for Individuals
1160
+
1161
+ Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/ruby-oauth#backer)]
1162
+
1163
+ NOTE: [kettle-readme-backers][kettle-readme-backers] updates this list every day, automatically.
1164
+
1165
+ <!-- OPENCOLLECTIVE-INDIVIDUALS:START -->
1166
+ No backers yet. Be the first!
1167
+ <!-- OPENCOLLECTIVE-INDIVIDUALS:END -->
1168
+
1169
+ ### Open Collective for Organizations
1170
+
1171
+ Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/ruby-oauth#sponsor)]
1172
+
1173
+ NOTE: [kettle-readme-backers][kettle-readme-backers] updates this list every day, automatically.
1174
+
1175
+ <!-- OPENCOLLECTIVE-ORGANIZATIONS:START -->
1176
+ No sponsors yet. Be the first!
1177
+
1178
+ ### Open Collective for Donors
1179
+
1180
+ [Bill Woika](https://opencollective.com/bill-woika)
1181
+ <!-- OPENCOLLECTIVE-ORGANIZATIONS:END -->
1182
+
1183
+ [kettle-readme-backers]: https://github.com/ruby-oauth/oauth2/blob/main/exe/kettle-readme-backers
1184
+
1185
+ ### Another way to support open-source
1186
+
1187
+ I’m driven by a passion to foster a thriving open-source community – a space where people can tackle complex problems, no matter how small. Revitalizing libraries that have fallen into disrepair, and building new libraries focused on solving real-world challenges, are my passions. I was recently affected by layoffs, and the tech jobs market is unwelcoming. I’m reaching out here because your support would significantly aid my efforts to provide for my family, and my farm (11 🐔 chickens, 2 🐶 dogs, 3 🐰 rabbits, 8 🐈‍ cats).
1188
+
1189
+ If you work at a company that uses my work, please encourage them to support me as a corporate sponsor. My work on gems you use might show up in `bundle fund`.
1190
+
1191
+ I’m developing a new library, [floss_funding][🖇floss-funding-gem], designed to empower open-source developers like myself to get paid for the work we do, in a sustainable way. Please give it a look.
1192
+
1193
+ **[Floss-Funding.dev][🖇floss-funding.dev]: 👉️ No network calls. 👉️ No tracking. 👉️ No oversight. 👉️ Minimal crypto hashing. 💡 Easily disabled nags**
1194
+
1195
+ [![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 efforts at ko-fi.com][🖇kofi-img]][🖇kofi] [![Donate to my FLOSS efforts using Patreon][🖇patreon-img]][🖇patreon]
1196
+
1197
+ ## 🔐 Security
1198
+
1199
+ To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
1200
+ Tidelift will coordinate the fix and disclosure.
1201
+
1202
+ For more see [SECURITY.md][🔐security], [THREAT_MODEL.md][🔐threat-model], and [IRP.md][🔐irp].
1203
+
1204
+ ## 🤝 Contributing
1205
+
1206
+ If you need some ideas of where to help, you could work on adding more code coverage,
1207
+ or if it is already 💯 (see [below](#code-coverage)) check [reek](REEK), [issues][🤝gh-issues], or [PRs][🤝gh-pulls],
1208
+ or use the gem and think about how it could be better.
1209
+
1210
+ We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.
1211
+
1212
+ See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
1213
+
1214
+ ### 🚀 Release Instructions
1215
+
1216
+ See [CONTRIBUTING.md][🤝contributing].
1217
+
1218
+ ### Code Coverage
1219
+
1220
+ [![Coverage Graph][🏀codecov-g]][🏀codecov]
1221
+
1222
+ [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls]
1223
+
1224
+ [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov]
1225
+
1226
+ ### 🪇 Code of Conduct
1227
+
1228
+ Everyone interacting with this project's codebases, issue trackers,
1229
+ chat rooms and mailing lists agrees to follow the [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct].
1230
+
1231
+ ## 🌈 Contributors
1232
+
1233
+ [![Contributors][🖐contributors-img]][🖐contributors]
1234
+
1235
+ Made with [contributors-img][🖐contrib-rocks].
1236
+
1237
+ Also see GitLab Contributors: [https://gitlab.com/ruby-oauth/oauth2/-/graphs/main][🚎contributors-gl]
1238
+
1239
+ <details>
1240
+ <summary>⭐️ Star History</summary>
1241
+
1242
+ <a href="https://star-history.com/#ruby-oauth/oauth2&Date">
1243
+ <picture>
1244
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=ruby-oauth/oauth2&type=Date&theme=dark" />
1245
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=ruby-oauth/oauth2&type=Date" />
1246
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=ruby-oauth/oauth2&type=Date" />
1247
+ </picture>
1248
+ </a>
1249
+
1250
+ </details>
1251
+
1252
+ ## 📌 Versioning
1253
+
1254
+ This Library adheres to [![Semantic Versioning 2.0.0][📌semver-img]][📌semver].
1255
+ Violations of this scheme should be reported as bugs.
1256
+ Specifically, if a minor or patch version is released that breaks backward compatibility,
1257
+ a new version should be immediately released that restores compatibility.
1258
+ Breaking changes to the public API will only be introduced with new major versions.
1259
+
1260
+ > dropping support for a platform is both obviously and objectively a breaking change <br/>
1261
+ >—Jordan Harband ([@ljharb](https://github.com/ljharb), maintainer of SemVer) [in SemVer issue 716][📌semver-breaking]
1262
+
1263
+ I understand that policy doesn't work universally ("exceptions to every rule!"),
1264
+ but it is the policy here.
1265
+ As such, in many cases it is good to specify a dependency on this library using
1266
+ the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
407
1267
 
408
1268
  For example:
409
1269
 
410
1270
  ```ruby
411
- spec.add_dependency 'oauth2', '~> 1.4'
1271
+ spec.add_dependency("oauth2", "~> 2.0")
412
1272
  ```
413
1273
 
414
- [semver]: http://semver.org/
415
- [pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
1274
+ <details markdown="1">
1275
+ <summary>📌 Is "Platform Support" part of the public API? More details inside.</summary>
1276
+
1277
+ SemVer should, IMO, but doesn't explicitly, say that dropping support for specific Platforms
1278
+ is a *breaking change* to an API, and for that reason the bike shedding is endless.
416
1279
 
417
- ## License
1280
+ To get a better understanding of how SemVer is intended to work over a project's lifetime,
1281
+ read this article from the creator of SemVer:
418
1282
 
419
- [![License: MIT][🖇src-license-img]][🖇src-license]
1283
+ - ["Major Version Numbers are Not Sacred"][📌major-versions-not-sacred]
420
1284
 
421
- - Copyright (c) 2011-2013 Michael Bleigh and Intridea, Inc.
422
- - Copyright (c) 2017-2022 [oauth-xx organization][oauth-xx]
423
- - See [LICENSE][license] for details.
1285
+ </details>
424
1286
 
425
- [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2.svg?type=large)][fossa2]
1287
+ See [CHANGELOG.md][📌changelog] for a list of releases.
426
1288
 
427
- [license]: https://gitlab.com/oauth-xx/oauth2/-/blob/main/LICENSE
428
- [oauth-xx]: https://gitlab.com/oauth-xx
429
- [fossa2]: https://app.fossa.io/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2?ref=badge_large
1289
+ ## 📄 License
430
1290
 
431
- ## Development
1291
+ The gem is available as open source under the terms of
1292
+ the [MIT License][📄license] [![License: MIT][📄license-img]][📄license-ref].
1293
+ See [LICENSE.txt][📄license] for the official [Copyright Notice][📄copyright-notice-explainer].
432
1294
 
433
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
1295
+ ### © Copyright
434
1296
 
435
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
1297
+ <ul>
1298
+ <li>
1299
+ Copyright (c) 2017 – 2026 Peter H. Boling, of
1300
+ <a href="https://discord.gg/3qme4XHNKN">
1301
+ Galtzo.com
1302
+ <picture>
1303
+ <img src="https://logos.galtzo.com/assets/images/galtzo-floss/avatar-128px-blank.svg" alt="Galtzo.com Logo (Wordless) by Aboling0, CC BY-SA 4.0" width="24">
1304
+ </picture>
1305
+ </a>, and oauth2 contributors.
1306
+ </li>
1307
+ <li>
1308
+ Copyright (c) 2011 - 2013 Michael Bleigh and Intridea, Inc.
1309
+ </li>
1310
+ </ul>
436
1311
 
437
- ## Contributing
1312
+ ## 🤑 A request for help
438
1313
 
439
- See [CONTRIBUTING.md][contributing]
1314
+ Maintainers have teeth and need to pay their dentists.
1315
+ After getting laid off in an RIF in March, and encountering difficulty finding a new one,
1316
+ I began spending most of my time building open source tools.
1317
+ I'm hoping to be able to pay for my kids' health insurance this month,
1318
+ so if you value the work I am doing, I need your support.
1319
+ Please consider sponsoring me or the project.
440
1320
 
441
- [contributing]: https://gitlab.com/oauth-xx/oauth2/-/blob/main/CONTRIBUTING.md
1321
+ To join the community or get help 👇️ Join the Discord.
442
1322
 
443
- ## Contributors
1323
+ [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]
444
1324
 
445
- [![Contributors](https://contrib.rocks/image?repo=oauth-xx/oauth2)]("https://gitlab.com/oauth-xx/oauth2/-/graphs/main")
1325
+ To say "thanks!" ☝️ Join the Discord or 👇️ send money.
446
1326
 
447
- Made with [contributors-img](https://contrib.rocks).
1327
+ [![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] 💌 [![Donate on PayPal][🖇paypal-bottom-img]][🖇paypal]
448
1328
 
449
- ## Code of Conduct
1329
+ ### Please give the project a star ⭐ ♥.
450
1330
 
451
- Everyone interacting in the OAuth2 project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/oauth-xx/oauth2/-/blob/main/CODE_OF_CONDUCT.md).
1331
+ Thanks for RTFM. ☺️
1332
+
1333
+ [⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611&style=flat
1334
+ [⛳liberapay-bottom-img]: https://img.shields.io/liberapay/goal/pboling.svg?style=for-the-badge&logo=liberapay&color=a51611
1335
+ [⛳liberapay]: https://liberapay.com/pboling/donate
1336
+ [🖇osc-all-img]: https://img.shields.io/opencollective/all/ruby-oauth
1337
+ [🖇osc-sponsors-img]: https://img.shields.io/opencollective/sponsors/ruby-oauth
1338
+ [🖇osc-backers-img]: https://img.shields.io/opencollective/backers/ruby-oauth
1339
+ [🖇osc-backers]: https://opencollective.com/ruby-oauth#backer
1340
+ [🖇osc-backers-i]: https://opencollective.com/ruby-oauth/backers/badge.svg?style=flat
1341
+ [🖇osc-sponsors]: https://opencollective.com/ruby-oauth#sponsor
1342
+ [🖇osc-sponsors-i]: https://opencollective.com/ruby-oauth/sponsors/badge.svg?style=flat
1343
+ [🖇osc-all-bottom-img]: https://img.shields.io/opencollective/all/ruby-oauth?style=for-the-badge
1344
+ [🖇osc-sponsors-bottom-img]: https://img.shields.io/opencollective/sponsors/ruby-oauth?style=for-the-badge
1345
+ [🖇osc-backers-bottom-img]: https://img.shields.io/opencollective/backers/ruby-oauth?style=for-the-badge
1346
+ [🖇osc]: https://opencollective.com/ruby-oauth
1347
+ [🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
1348
+ [🖇sponsor-bottom-img]: https://img.shields.io/badge/Sponsor_Me!-pboling-blue?style=for-the-badge&logo=github
1349
+ [🖇sponsor]: https://github.com/sponsors/pboling
1350
+ [🖇polar-img]: https://img.shields.io/badge/polar-donate-a51611.svg?style=flat
1351
+ [🖇polar]: https://polar.sh/pboling
1352
+ [🖇kofi-img]: https://img.shields.io/badge/ko--fi-%E2%9C%93-a51611.svg?style=flat
1353
+ [🖇kofi]: https://ko-fi.com/O5O86SNP4
1354
+ [🖇patreon-img]: https://img.shields.io/badge/patreon-donate-a51611.svg?style=flat
1355
+ [🖇patreon]: https://patreon.com/galtzo
1356
+ [🖇buyme-small-img]: https://img.shields.io/badge/buy_me_a_coffee-%E2%9C%93-a51611.svg?style=flat
1357
+ [🖇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
1358
+ [🖇buyme]: https://www.buymeacoffee.com/pboling
1359
+ [🖇paypal-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=flat&logo=paypal
1360
+ [🖇paypal-bottom-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=for-the-badge&logo=paypal&color=0A0A0A
1361
+ [🖇paypal]: https://www.paypal.com/paypalme/peterboling
1362
+ [🖇floss-funding.dev]: https://floss-funding.dev
1363
+ [🖇floss-funding-gem]: https://github.com/galtzo-floss/floss_funding
1364
+ [✉️discord-invite]: https://discord.gg/3qme4XHNKN
1365
+ [✉️discord-invite-img-ftb]: https://img.shields.io/discord/1373797679469170758?style=for-the-badge&logo=discord
1366
+ [✉️ruby-friends-img]: https://img.shields.io/badge/daily.dev-%F0%9F%92%8E_Ruby_Friends-0A0A0A?style=for-the-badge&logo=dailydotdev&logoColor=white
1367
+ [✉️ruby-friends]: https://app.daily.dev/squads/rubyfriends
1368
+
1369
+ [⛳gg-discussions]: https://groups.google.com/g/oauth-ruby
1370
+ [⛳gg-discussions-img]: https://img.shields.io/badge/google-group-0093D0.svg?style=for-the-badge&logo=google&logoColor=orange
1371
+
1372
+ [✇bundle-group-pattern]: https://gist.github.com/pboling/4564780
1373
+ [⛳️gem-namespace]: https://github.com/ruby-oauth/oauth2
1374
+ [⛳️namespace-img]: https://img.shields.io/badge/namespace-OAuth2-3C2D2D.svg?style=square&logo=ruby&logoColor=white
1375
+ [⛳️gem-name]: https://bestgems.org/gems/oauth2
1376
+ [⛳️name-img]: https://img.shields.io/badge/name-oauth2-3C2D2D.svg?style=square&logo=rubygems&logoColor=red
1377
+ [⛳️tag-img]: https://img.shields.io/github/tag/ruby-oauth/oauth2.svg
1378
+ [⛳️tag]: http://github.com/ruby-oauth/oauth2/releases
1379
+ [🚂maint-blog]: http://www.railsbling.com/tags/oauth2
1380
+ [🚂maint-blog-img]: https://img.shields.io/badge/blog-railsbling-0093D0.svg?style=for-the-badge&logo=rubyonrails&logoColor=orange
1381
+ [🚂maint-contact]: http://www.railsbling.com/contact
1382
+ [🚂maint-contact-img]: https://img.shields.io/badge/Contact-Maintainer-0093D0.svg?style=flat&logo=rubyonrails&logoColor=red
1383
+ [💖🖇linkedin]: http://www.linkedin.com/in/peterboling
1384
+ [💖🖇linkedin-img]: https://img.shields.io/badge/PeterBoling-LinkedIn-0B66C2?style=flat&logo=newjapanprowrestling
1385
+ [💖✌️wellfound]: https://wellfound.com/u/peter-boling
1386
+ [💖✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=flat&logo=wellfound
1387
+ [💖💲crunchbase]: https://www.crunchbase.com/person/peter-boling
1388
+ [💖💲crunchbase-img]: https://img.shields.io/badge/peter--boling-purple?style=flat&logo=crunchbase
1389
+ [💖🐘ruby-mast]: https://ruby.social/@galtzo
1390
+ [💖🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https://ruby.social&style=flat&logo=mastodon&label=Ruby%20@galtzo
1391
+ [💖🦋bluesky]: https://bsky.app/profile/galtzo.com
1392
+ [💖🦋bluesky-img]: https://img.shields.io/badge/@galtzo.com-0285FF?style=flat&logo=bluesky&logoColor=white
1393
+ [💖🌳linktree]: https://linktr.ee/galtzo
1394
+ [💖🌳linktree-img]: https://img.shields.io/badge/galtzo-purple?style=flat&logo=linktree
1395
+ [💖💁🏼‍♂️devto]: https://dev.to/galtzo
1396
+ [💖💁🏼‍♂️devto-img]: https://img.shields.io/badge/dev.to-0A0A0A?style=flat&logo=devdotto&logoColor=white
1397
+ [💖💁🏼‍♂️aboutme]: https://about.me/peter.boling
1398
+ [💖💁🏼‍♂️aboutme-img]: https://img.shields.io/badge/about.me-0A0A0A?style=flat&logo=aboutme&logoColor=white
1399
+ [💖🧊berg]: https://codeberg.org/pboling
1400
+ [💖🐙hub]: https://github.org/pboling
1401
+ [💖🛖hut]: https://sr.ht/~galtzo/
1402
+ [💖🧪lab]: https://gitlab.com/pboling
1403
+ [👨🏼‍🏫expsup-upwork]: https://www.upwork.com/freelancers/~014942e9b056abdf86?mp_source=share
1404
+ [👨🏼‍🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge&logo=Upwork&logoColor=white
1405
+ [👨🏼‍🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
1406
+ [👨🏼‍🏫expsup-codementor-img]: https://img.shields.io/badge/CodeMentor-Get_Help-1abc9c?style=for-the-badge&logo=CodeMentor&logoColor=white
1407
+ [🏙️entsup-tidelift]: https://tidelift.com/subscription/pkg/rubygems-oauth2?utm_source=rubygems-oauth2&utm_medium=referral&utm_campaign=readme
1408
+ [🏙️entsup-tidelift-img]: https://img.shields.io/badge/Tidelift_and_Sonar-Enterprise_Support-FD3456?style=for-the-badge&logo=sonar&logoColor=white
1409
+ [🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar
1410
+ [💁🏼‍♂️peterboling]: http://www.peterboling.com
1411
+ [🚂railsbling]: http://www.railsbling.com
1412
+ [📜src-gl-img]: https://img.shields.io/badge/GitLab-FBA326?style=for-the-badge&logo=Gitlab&logoColor=orange
1413
+ [📜src-gl]: https://gitlab.com/ruby-oauth/oauth2/
1414
+ [📜src-cb-img]: https://img.shields.io/badge/CodeBerg-4893CC?style=for-the-badge&logo=CodeBerg&logoColor=blue
1415
+ [📜src-cb]: https://codeberg.org/ruby-oauth/oauth2
1416
+ [📜src-gh-img]: https://img.shields.io/badge/GitHub-238636?style=for-the-badge&logo=Github&logoColor=green
1417
+ [📜src-gh]: https://github.com/ruby-oauth/oauth2
1418
+ [📜docs-cr-rd-img]: https://img.shields.io/badge/RubyDoc-Current_Release-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
1419
+ [📜docs-head-rd-img]: https://img.shields.io/badge/YARD_on_Galtzo.com-HEAD-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
1420
+ [📜gl-wiki]: https://gitlab.com/ruby-oauth/oauth2/-/wikis/home
1421
+ [📜gh-wiki]: https://github.com/ruby-oauth/oauth2/wiki
1422
+ [📜gl-wiki-img]: https://img.shields.io/badge/wiki-examples-943CD2.svg?style=for-the-badge&logo=gitlab&logoColor=white
1423
+ [📜gh-wiki-img]: https://img.shields.io/badge/wiki-examples-943CD2.svg?style=for-the-badge&logo=github&logoColor=white
1424
+ [👽dl-rank]: https://bestgems.org/gems/oauth2
1425
+ [👽dl-ranki]: https://img.shields.io/gem/rd/oauth2.svg
1426
+ [👽version]: https://bestgems.org/gems/oauth2
1427
+ [👽versioni]: https://img.shields.io/gem/v/oauth2.svg
1428
+ [🏀qlty-mnt]: https://qlty.sh/gh/ruby-oauth/projects/oauth2
1429
+ [🏀qlty-mnti]: https://qlty.sh/gh/ruby-oauth/projects/oauth2/maintainability.svg
1430
+ [🏀qlty-cov]: https://qlty.sh/gh/ruby-oauth/projects/oauth2/metrics/code?sort=coverageRating
1431
+ [🏀qlty-covi]: https://qlty.sh/gh/ruby-oauth/projects/oauth2/coverage.svg
1432
+ [🏀codecov]: https://codecov.io/gh/ruby-oauth/oauth2
1433
+ [🏀codecovi]: https://codecov.io/gh/ruby-oauth/oauth2/graph/badge.svg
1434
+ [🏀coveralls]: https://coveralls.io/github/ruby-oauth/oauth2?branch=main
1435
+ [🏀coveralls-img]: https://coveralls.io/repos/github/ruby-oauth/oauth2/badge.svg?branch=main
1436
+ [🖐codeQL]: https://github.com/ruby-oauth/oauth2/security/code-scanning
1437
+ [🖐codeQL-img]: https://github.com/ruby-oauth/oauth2/actions/workflows/codeql-analysis.yml/badge.svg
1438
+ [🚎1-an-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/ancient.yml
1439
+ [🚎1-an-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/ancient.yml/badge.svg
1440
+ [🚎2-cov-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/coverage.yml
1441
+ [🚎2-cov-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/coverage.yml/badge.svg
1442
+ [🚎3-hd-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/heads.yml
1443
+ [🚎3-hd-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/heads.yml/badge.svg
1444
+ [🚎4-lg-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/legacy.yml
1445
+ [🚎4-lg-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/legacy.yml/badge.svg
1446
+ [🚎5-st-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/style.yml
1447
+ [🚎5-st-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/style.yml/badge.svg
1448
+ [🚎6-s-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/supported.yml
1449
+ [🚎6-s-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/supported.yml/badge.svg
1450
+ [🚎7-us-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/unsupported.yml
1451
+ [🚎7-us-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/unsupported.yml/badge.svg
1452
+ [🚎8-ho-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/hoary.yml
1453
+ [🚎8-ho-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/hoary.yml/badge.svg
1454
+ [🚎10-j-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/jruby.yml
1455
+ [🚎10-j-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/jruby.yml/badge.svg
1456
+ [🚎11-c-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/current.yml
1457
+ [🚎11-c-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/current.yml/badge.svg
1458
+ [🚎12-crh-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/dep-heads.yml
1459
+ [🚎12-crh-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/dep-heads.yml/badge.svg
1460
+ [🚎13-cbs-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/caboose.yml
1461
+ [🚎13-cbs-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/caboose.yml/badge.svg
1462
+ [🚎13-🔒️-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/locked_deps.yml
1463
+ [🚎13-🔒️-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/locked_deps.yml/badge.svg
1464
+ [🚎14-🔓️-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/unlocked_deps.yml
1465
+ [🚎14-🔓️-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/unlocked_deps.yml/badge.svg
1466
+ [🚎15-🪪-wf]: https://github.com/ruby-oauth/oauth2/actions/workflows/license-eye.yml
1467
+ [🚎15-🪪-wfi]: https://github.com/ruby-oauth/oauth2/actions/workflows/license-eye.yml/badge.svg
1468
+ [💎ruby-2.2i]: https://img.shields.io/badge/Ruby-2.2_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=white
1469
+ [💎ruby-2.3i]: https://img.shields.io/badge/Ruby-2.3-DF00CA?style=for-the-badge&logo=ruby&logoColor=white
1470
+ [💎ruby-2.4i]: https://img.shields.io/badge/Ruby-2.4-DF00CA?style=for-the-badge&logo=ruby&logoColor=white
1471
+ [💎ruby-2.5i]: https://img.shields.io/badge/Ruby-2.5-DF00CA?style=for-the-badge&logo=ruby&logoColor=white
1472
+ [💎ruby-2.6i]: https://img.shields.io/badge/Ruby-2.6-DF00CA?style=for-the-badge&logo=ruby&logoColor=white
1473
+ [💎ruby-2.7i]: https://img.shields.io/badge/Ruby-2.7-DF00CA?style=for-the-badge&logo=ruby&logoColor=white
1474
+ [💎ruby-3.0i]: https://img.shields.io/badge/Ruby-3.0-CC342D?style=for-the-badge&logo=ruby&logoColor=white
1475
+ [💎ruby-3.1i]: https://img.shields.io/badge/Ruby-3.1-CC342D?style=for-the-badge&logo=ruby&logoColor=white
1476
+ [💎ruby-3.2i]: https://img.shields.io/badge/Ruby-3.2-CC342D?style=for-the-badge&logo=ruby&logoColor=white
1477
+ [💎ruby-3.3i]: https://img.shields.io/badge/Ruby-3.3-CC342D?style=for-the-badge&logo=ruby&logoColor=white
1478
+ [💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
1479
+ [💎ruby-headi]: https://img.shields.io/badge/Ruby-HEAD-CC342D?style=for-the-badge&logo=ruby&logoColor=blue
1480
+ [💎truby-22.3i]: https://img.shields.io/badge/Truffle_Ruby-22.3_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=pink
1481
+ [💎truby-23.0i]: https://img.shields.io/badge/Truffle_Ruby-23.0_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=pink
1482
+ [💎truby-23.1i]: https://img.shields.io/badge/Truffle_Ruby-23.1_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=pink
1483
+ [💎truby-c-i]: https://img.shields.io/badge/Truffle_Ruby-current-34BCB1?style=for-the-badge&logo=ruby&logoColor=green
1484
+ [💎truby-headi]: https://img.shields.io/badge/Truffle_Ruby-HEAD-34BCB1?style=for-the-badge&logo=ruby&logoColor=blue
1485
+ [💎jruby-9.1i]: https://img.shields.io/badge/JRuby-9.1_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=red
1486
+ [💎jruby-9.2i]: https://img.shields.io/badge/JRuby-9.2_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=red
1487
+ [💎jruby-9.3i]: https://img.shields.io/badge/JRuby-9.3_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=red
1488
+ [💎jruby-9.4i]: https://img.shields.io/badge/JRuby-9.4-FBE742?style=for-the-badge&logo=ruby&logoColor=red
1489
+ [💎jruby-c-i]: https://img.shields.io/badge/JRuby-current-FBE742?style=for-the-badge&logo=ruby&logoColor=green
1490
+ [💎jruby-headi]: https://img.shields.io/badge/JRuby-HEAD-FBE742?style=for-the-badge&logo=ruby&logoColor=blue
1491
+ [🤝gh-issues]: https://github.com/ruby-oauth/oauth2/issues
1492
+ [🤝gh-pulls]: https://github.com/ruby-oauth/oauth2/pulls
1493
+ [🤝gl-issues]: https://gitlab.com/ruby-oauth/oauth2/-/issues
1494
+ [🤝gl-pulls]: https://gitlab.com/ruby-oauth/oauth2/-/merge_requests
1495
+ [🤝cb-issues]: https://codeberg.org/ruby-oauth/oauth2/issues
1496
+ [🤝cb-pulls]: https://codeberg.org/ruby-oauth/oauth2/pulls
1497
+ [🤝cb-donate]: https://donate.codeberg.org/
1498
+ [🤝contributing]: CONTRIBUTING.md
1499
+ [🏀codecov-g]: https://codecov.io/gh/ruby-oauth/oauth2/graphs/tree.svg
1500
+ [🖐contrib-rocks]: https://contrib.rocks
1501
+ [🖐contributors]: https://github.com/ruby-oauth/oauth2/graphs/contributors
1502
+ [🖐contributors-img]: https://contrib.rocks/image?repo=ruby-oauth/oauth2
1503
+ [🚎contributors-gl]: https://gitlab.com/ruby-oauth/oauth2/-/graphs/main
1504
+ [🪇conduct]: CODE_OF_CONDUCT.md
1505
+ [🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-2.1-259D6C.svg
1506
+ [📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
1507
+ [📌semver]: https://semver.org/spec/v2.0.0.html
1508
+ [📌semver-img]: https://img.shields.io/badge/semver-2.0.0-259D6C.svg?style=flat
1509
+ [📌semver-breaking]: https://github.com/semver/semver/issues/716#issuecomment-869336139
1510
+ [📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
1511
+ [📌changelog]: CHANGELOG.md
1512
+ [📗keep-changelog]: https://keepachangelog.com/en/1.0.0/
1513
+ [📗keep-changelog-img]: https://img.shields.io/badge/keep--a--changelog-1.0.0-34495e.svg?style=flat
1514
+ [📌gitmoji]: https://gitmoji.dev
1515
+ [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
1516
+ [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
1517
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.527-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1518
+ [🔐security]: SECURITY.md
1519
+ [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
1520
+ [🔐irp]: IRP.md
1521
+ [🔐irp-img]: https://img.shields.io/badge/IRP-259D6C.svg?style=flat
1522
+ [🔐threat-model]: THREAT_MODEL.md
1523
+ [🔐threat-model-img]: https://img.shields.io/badge/threat-model-259D6C.svg?style=flat
1524
+ [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
1525
+ [📄license]: LICENSE.txt
1526
+ [📄license-ref]: https://opensource.org/licenses/MIT
1527
+ [📄license-img]: https://img.shields.io/badge/License-MIT-259D6C.svg
1528
+ [📄license-compat]: https://dev.to/galtzo/how-to-check-license-compatibility-41h0
1529
+ [📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A-%E2%9C%93-259D6C.svg?style=flat&logo=Apache
1530
+ [📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
1531
+ [📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
1532
+ [🚎yard-current]: http://rubydoc.info/gems/oauth2
1533
+ [🚎yard-head]: https://oauth2.galtzo.com
1534
+ [💎stone_checksums]: https://github.com/galtzo-floss/stone_checksums
1535
+ [💎SHA_checksums]: https://gitlab.com/ruby-oauth/oauth2/-/tree/main/checksums
1536
+ [💎rlts]: https://github.com/rubocop-lts/rubocop-lts
1537
+ [💎rlts-img]: https://img.shields.io/badge/code_style_&_linting-rubocop--lts-34495e.svg?plastic&logo=ruby&logoColor=white
1538
+ [💎appraisal2]: https://github.com/appraisal-rb/appraisal2
1539
+ [💎appraisal2-img]: https://img.shields.io/badge/appraised_by-appraisal2-34495e.svg?plastic&logo=ruby&logoColor=white
1540
+ [💎d-in-dvcs]: https://railsbling.com/posts/dvcs/put_the_d_in_dvcs/
1541
+
1542
+ <details>
1543
+ <summary>
1544
+ rel="me" Social Proofs
1545
+ </summary>
1546
+
1547
+ <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>
1548
+ <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>
1549
+
1550
+ </details>