Skip to content

Commit 1cdb488

Browse files
authored
api/v1/revoke_token HTTP status code change (#115)
* api/v1/revoke_token HTTP status code change
1 parent 0654440 commit 1cdb488

10 files changed

Lines changed: 955 additions & 299 deletions

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ Unreleased
1010

1111
- Support 202 "Accepted" HTTP responses.
1212

13+
**Fixed**
14+
15+
- The expected HTTP response status code for a request made with the proper credentials
16+
to api/v1/revoke_token has been changed from 204 to 200.
17+
1318
2.1.0 (2021-06-07)
1419
------------------
1520

prawcore/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def revoke_token(self, token, token_type=None):
9393
if token_type is not None:
9494
data["token_type_hint"] = token_type
9595
url = self._requestor.reddit_url + const.REVOKE_TOKEN_PATH
96-
self._post(url, success_status=codes["no_content"], **data)
96+
self._post(url, **data)
9797

9898

9999
class TrustedAuthenticator(BaseAuthenticator):
Lines changed: 235 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,98 @@
11
{
22
"http_interactions": [
33
{
4-
"recorded_at": "2016-07-09T22:26:13",
4+
"recorded_at": "2021-06-07T11:40:17",
55
"request": {
66
"body": {
77
"encoding": "utf-8",
88
"string": "grant_type=refresh_token&refresh_token=<REFRESH_TOKEN>"
99
},
1010
"headers": {
11-
"Accept": "*/*",
12-
"Accept-Encoding": "gzip, deflate",
13-
"Authorization": "Basic <BASIC_AUTH>",
14-
"Connection": "keep-alive",
15-
"Content-Length": "74",
16-
"Content-Type": "application/x-www-form-urlencoded",
17-
"Cookie": "__cfduid=dd555eb868b1bcfd517d08fcb174c3afc1454806972",
18-
"User-Agent": "prawcore:test (by /u/bboe) prawcore/0.0.8"
11+
"Accept": [
12+
"*/*"
13+
],
14+
"Accept-Encoding": [
15+
"gzip, deflate"
16+
],
17+
"Authorization": [
18+
"Basic <BASIC_AUTH>"
19+
],
20+
"Connection": [
21+
"close"
22+
],
23+
"Content-Length": [
24+
"78"
25+
],
26+
"Content-Type": [
27+
"application/x-www-form-urlencoded"
28+
],
29+
"Cookie": [
30+
"edgebucket=546C0rA0lZHlHLA00s"
31+
],
32+
"User-Agent": [
33+
"prawcore:test (by /u/bboe) prawcore/2.0.0"
34+
]
1935
},
2036
"method": "POST",
2137
"uri": "https://www.reddit.com/api/v1/access_token"
2238
},
2339
"response": {
2440
"body": {
25-
"base64_string": "H4sIAAAAAAAAAyXMsQrCMBSF4VcJd+4QEFTcdHBUC4VClxCTA70tJOUmlgbx3SW6fvznvMk6h5RMjjMCnRTN/dAfh8ehnYxtp6tdL7J1r/Po75oaRb/O5LKgxk9YgVT3WNnBsK98iwEVsS0sSIbr826vdaMoufjfjpxylKLYI2TORQmsp88X6VXzg5IAAAA=",
2641
"encoding": "UTF-8",
27-
"string": ""
42+
"string": "{\"access_token\": \"1234678-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"token_type\": \"bearer\", \"expires_in\": 3600, \"refresh_token\": \"1234678-111111111111111111111111111111\", \"scope\": \"identity\"}"
2843
},
2944
"headers": {
30-
"CF-RAY": "2bff324294db2963-DUB",
31-
"Connection": "keep-alive",
32-
"Content-Encoding": "gzip",
33-
"Content-Type": "application/json; charset=UTF-8",
34-
"Date": "Sat, 09 Jul 2016 22:26:13 GMT",
35-
"Server": "cloudflare-nginx",
36-
"Strict-Transport-Security": "max-age=15552000; includeSubDomains; preload",
37-
"Transfer-Encoding": "chunked",
38-
"X-Moose": "majestic",
39-
"cache-control": "max-age=0, must-revalidate",
40-
"set-cookie": "loid=S1UX7gEWPLHZFXDMKZ; Domain=reddit.com; Max-Age=63071999; Path=/; expires=Mon, 09-Jul-2018 22:26:13 GMT; secure",
41-
"x-content-type-options": "nosniff",
42-
"x-frame-options": "SAMEORIGIN",
43-
"x-xss-protection": "1; mode=block"
45+
"Accept-Ranges": [
46+
"bytes"
47+
],
48+
"Connection": [
49+
"close"
50+
],
51+
"Content-Length": [
52+
"184"
53+
],
54+
"Content-Type": [
55+
"application/json; charset=UTF-8"
56+
],
57+
"Date": [
58+
"Mon, 07 Jun 2021 11:40:17 GMT"
59+
],
60+
"Server": [
61+
"snooserv"
62+
],
63+
"Strict-Transport-Security": [
64+
"max-age=15552000; includeSubDomains; preload"
65+
],
66+
"Via": [
67+
"1.1 varnish"
68+
],
69+
"X-Clacks-Overhead": [
70+
"GNU Terry Pratchett"
71+
],
72+
"X-Moose": [
73+
"majestic"
74+
],
75+
"cache-control": [
76+
"max-age=0, must-revalidate"
77+
],
78+
"x-content-type-options": [
79+
"nosniff"
80+
],
81+
"x-frame-options": [
82+
"SAMEORIGIN"
83+
],
84+
"x-ratelimit-remaining": [
85+
"299"
86+
],
87+
"x-ratelimit-reset": [
88+
"583"
89+
],
90+
"x-ratelimit-used": [
91+
"1"
92+
],
93+
"x-xss-protection": [
94+
"1; mode=block"
95+
]
4496
},
4597
"status": {
4698
"code": 200,
@@ -50,21 +102,37 @@
50102
}
51103
},
52104
{
53-
"recorded_at": "2016-07-09T22:26:13",
105+
"recorded_at": "2021-06-07T11:40:17",
54106
"request": {
55107
"body": {
56108
"encoding": "utf-8",
57-
"string": "token=kWZW8ZP7Qj_aQjFavBrxTuAhdO0&token_type_hint=access_token"
109+
"string": "token=1234678-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&token_type_hint=access_token"
58110
},
59111
"headers": {
60-
"Accept": "*/*",
61-
"Accept-Encoding": "gzip, deflate",
62-
"Authorization": "Basic <BASIC_AUTH>",
63-
"Connection": "keep-alive",
64-
"Content-Length": "62",
65-
"Content-Type": "application/x-www-form-urlencoded",
66-
"Cookie": "loid=S1UX7gEWPLHZFXDMKZ; loidcreated=2016-07-09T22%3A26%3A13.585Z; __cfduid=dd555eb868b1bcfd517d08fcb174c3afc1454806972",
67-
"User-Agent": "prawcore:test (by /u/bboe) prawcore/0.0.8"
112+
"Accept": [
113+
"*/*"
114+
],
115+
"Accept-Encoding": [
116+
"gzip, deflate"
117+
],
118+
"Authorization": [
119+
"Basic <BASIC_AUTH>"
120+
],
121+
"Connection": [
122+
"close"
123+
],
124+
"Content-Length": [
125+
"74"
126+
],
127+
"Content-Type": [
128+
"application/x-www-form-urlencoded"
129+
],
130+
"Cookie": [
131+
"edgebucket=546C0rA0lZHlHLA00s"
132+
],
133+
"User-Agent": [
134+
"prawcore:test (by /u/bboe) prawcore/2.0.0"
135+
]
68136
},
69137
"method": "POST",
70138
"uri": "https://www.reddit.com/api/v1/revoke_token"
@@ -75,66 +143,158 @@
75143
"string": ""
76144
},
77145
"headers": {
78-
"CF-RAY": "2bff324364eb2963-DUB",
79-
"Connection": "keep-alive",
80-
"Content-Length": "0",
81-
"Content-Type": "application/json; charset=UTF-8",
82-
"Date": "Sat, 09 Jul 2016 22:26:13 GMT",
83-
"Server": "cloudflare-nginx",
84-
"Strict-Transport-Security": "max-age=15552000; includeSubDomains; preload",
85-
"X-Moose": "majestic",
86-
"cache-control": "max-age=0, must-revalidate",
87-
"x-content-type-options": "nosniff",
88-
"x-frame-options": "SAMEORIGIN",
89-
"x-xss-protection": "1; mode=block"
146+
"Accept-Ranges": [
147+
"bytes"
148+
],
149+
"Connection": [
150+
"close"
151+
],
152+
"Content-Length": [
153+
"0"
154+
],
155+
"Content-Type": [
156+
"application/json; charset=UTF-8"
157+
],
158+
"Date": [
159+
"Mon, 07 Jun 2021 11:40:18 GMT"
160+
],
161+
"Server": [
162+
"snooserv"
163+
],
164+
"Strict-Transport-Security": [
165+
"max-age=15552000; includeSubDomains; preload"
166+
],
167+
"Via": [
168+
"1.1 varnish"
169+
],
170+
"X-Clacks-Overhead": [
171+
"GNU Terry Pratchett"
172+
],
173+
"X-Moose": [
174+
"majestic"
175+
],
176+
"cache-control": [
177+
"max-age=0, must-revalidate"
178+
],
179+
"x-content-type-options": [
180+
"nosniff"
181+
],
182+
"x-frame-options": [
183+
"SAMEORIGIN"
184+
],
185+
"x-ratelimit-remaining": [
186+
"298"
187+
],
188+
"x-ratelimit-reset": [
189+
"582"
190+
],
191+
"x-ratelimit-used": [
192+
"2"
193+
],
194+
"x-xss-protection": [
195+
"1; mode=block"
196+
]
90197
},
91198
"status": {
92-
"code": 204,
93-
"message": "No Content"
199+
"code": 200,
200+
"message": "OK"
94201
},
95202
"url": "https://www.reddit.com/api/v1/revoke_token"
96203
}
97204
},
98205
{
99-
"recorded_at": "2016-07-09T22:26:14",
206+
"recorded_at": "2021-06-07T11:40:17",
100207
"request": {
101208
"body": {
102209
"encoding": "utf-8",
103-
"string": "grant_type=refresh_token&refresh_token=<REFRESH_TOKEN>"
210+
"string": "grant_type=refresh_token&refresh_token=1234678-111111111111111111111111111111"
104211
},
105212
"headers": {
106-
"Accept": "*/*",
107-
"Accept-Encoding": "gzip, deflate",
108-
"Authorization": "Basic <BASIC_AUTH>",
109-
"Connection": "keep-alive",
110-
"Content-Length": "74",
111-
"Content-Type": "application/x-www-form-urlencoded",
112-
"Cookie": "loid=S1UX7gEWPLHZFXDMKZ; loidcreated=2016-07-09T22%3A26%3A13.585Z; __cfduid=dd555eb868b1bcfd517d08fcb174c3afc1454806972",
113-
"User-Agent": "prawcore:test (by /u/bboe) prawcore/0.0.8"
213+
"Accept": [
214+
"*/*"
215+
],
216+
"Accept-Encoding": [
217+
"gzip, deflate"
218+
],
219+
"Authorization": [
220+
"Basic <BASIC_AUTH>"
221+
],
222+
"Connection": [
223+
"close"
224+
],
225+
"Content-Length": [
226+
"78"
227+
],
228+
"Content-Type": [
229+
"application/x-www-form-urlencoded"
230+
],
231+
"Cookie": [
232+
"edgebucket=546C0rA0lZHlHLA00s"
233+
],
234+
"User-Agent": [
235+
"prawcore:test (by /u/bboe) prawcore/2.0.0"
236+
]
114237
},
115238
"method": "POST",
116239
"uri": "https://www.reddit.com/api/v1/access_token"
117240
},
118241
"response": {
119242
"body": {
120-
"base64_string": "H4sIAAAAAAAAAyXMywrCMBCF4VcJs+6iIIi6dW3VKl5WISYHOghJmQTbQXx3iW4//nPe5LxHzrakJyJtDG1vBz2turVTvc7ny31/7HUYpp1MnhpDv84WHVHjB5xAqge82MNyqNyliIqYRxZky/V5sWzbxlD26b8dOJckajggFi5qBC7Q5wtT2GygkgAAAA==",
121243
"encoding": "UTF-8",
122-
"string": ""
244+
"string": "{\"access_token\": \"12345678-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"token_type\": \"bearer\", \"expires_in\": 3600, \"refresh_token\": \"12345678-222222222222222222222222222222\", \"scope\": \"identity\"}"
123245
},
124246
"headers": {
125-
"CF-RAY": "2bff3245e5052963-DUB",
126-
"Connection": "keep-alive",
127-
"Content-Encoding": "gzip",
128-
"Content-Type": "application/json; charset=UTF-8",
129-
"Date": "Sat, 09 Jul 2016 22:26:14 GMT",
130-
"Server": "cloudflare-nginx",
131-
"Strict-Transport-Security": "max-age=15552000; includeSubDomains; preload",
132-
"Transfer-Encoding": "chunked",
133-
"X-Moose": "majestic",
134-
"cache-control": "max-age=0, must-revalidate",
135-
"x-content-type-options": "nosniff",
136-
"x-frame-options": "SAMEORIGIN",
137-
"x-xss-protection": "1; mode=block"
247+
"Accept-Ranges": [
248+
"bytes"
249+
],
250+
"Connection": [
251+
"close"
252+
],
253+
"Content-Length": [
254+
"184"
255+
],
256+
"Content-Type": [
257+
"application/json; charset=UTF-8"
258+
],
259+
"Date": [
260+
"Mon, 07 Jun 2021 11:40:18 GMT"
261+
],
262+
"Server": [
263+
"snooserv"
264+
],
265+
"Strict-Transport-Security": [
266+
"max-age=15552000; includeSubDomains; preload"
267+
],
268+
"Via": [
269+
"1.1 varnish"
270+
],
271+
"X-Clacks-Overhead": [
272+
"GNU Terry Pratchett"
273+
],
274+
"X-Moose": [
275+
"majestic"
276+
],
277+
"cache-control": [
278+
"max-age=0, must-revalidate"
279+
],
280+
"x-content-type-options": [
281+
"nosniff"
282+
],
283+
"x-frame-options": [
284+
"SAMEORIGIN"
285+
],
286+
"x-ratelimit-remaining": [
287+
"297"
288+
],
289+
"x-ratelimit-reset": [
290+
"582"
291+
],
292+
"x-ratelimit-used": [
293+
"3"
294+
],
295+
"x-xss-protection": [
296+
"1; mode=block"
297+
]
138298
},
139299
"status": {
140300
"code": 200,
@@ -144,5 +304,5 @@
144304
}
145305
}
146306
],
147-
"recorded_with": "betamax/0.7.1"
307+
"recorded_with": "betamax/0.8.1"
148308
}

0 commit comments

Comments
 (0)