Commit 4fc74a4
committed
Refresh access tokens before expiry
We've seen a small number of exceptions in Experience CS[1] which are
caused by a 401 response from Editor API. I'm fairly confident these are
occurring when the access token used to make the request to Editor API
has expired. My hypothesis is that the token is valid at the time the
request comes into Experience CS (and therefore the auto refresh
behaviour isn't triggered) but is invalid by the time we make the
request to Editor API. This change reduces the risk of this happening by
refreshing the token if it expires in the next 60 seconds.
[1]: https://github.com/RaspberryPiFoundation/experience-cs/issues/9141 parent f9bebfe commit 4fc74a4
File tree
2 files changed
+7
-5
lines changed- lib/rpi_auth/controllers
- spec/dummy/spec/requests
2 files changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | | - | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
| 73 | + | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
0 commit comments