Commit 2e8758d
committed
Add expires_at, to match OmniAuth auth schema
OmniAuth's [Auth Hash Schema] should return an `expires_at` field as a
timestamp, but this gem returns `expires_in`. For compatibility with
other `oauth2` OmniAuth strategies, we should also return `expires_at`.
I'm not sure if the best place to fix it is here or upstream, in
`Rack::OAuth2::AccessToken`. On the one hand, the `oauth2` gem handles it
in `OAuth2::AccessToken`. On the other hand, the OmniAuth strategy is
the only place we can ensure minimal latency between the server response
and `expires_at` computation. I chose here. 🙂
[Auth Hash Schema]: https://github.com/omniauth/omniauth/wiki/Auth-Hash-Schema
n.b. I would have assumed that "timestamp" in the schema meant a Time
object, but all of the gems that inherit from `omniauth-oauth2` return
`Time#to_i`, which is also appropriate.1 parent 147b0ab commit 2e8758d
File tree
2 files changed
+16
-2
lines changed- lib/omniauth/strategies
- test/lib/omniauth/strategies
2 files changed
+16
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| |||
262 | 264 | | |
263 | 265 | | |
264 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
265 | 272 | | |
266 | 273 | | |
267 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
| 525 | + | |
525 | 526 | | |
526 | 527 | | |
527 | 528 | | |
| |||
530 | 531 | | |
531 | 532 | | |
532 | 533 | | |
533 | | - | |
| 534 | + | |
534 | 535 | | |
535 | 536 | | |
536 | 537 | | |
537 | 538 | | |
538 | 539 | | |
539 | 540 | | |
540 | 541 | | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
541 | 548 | | |
542 | 549 | | |
543 | 550 | | |
| |||
546 | 553 | | |
547 | 554 | | |
548 | 555 | | |
549 | | - | |
| 556 | + | |
550 | 557 | | |
551 | 558 | | |
552 | 559 | | |
| |||
0 commit comments