Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for optional scope specification to the password, client_credentials, and installed_client grants. (cherry picked from commit bb0e005)
- Loading branch information
1 parent
9140f35
commit 366d49a
Showing
9 changed files
with
322 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
tests/cassettes/DeviceIDAuthorizer_refresh__with_scopes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"interactions": [ | ||
{ | ||
"request": { | ||
"body": [ | ||
[ | ||
"device_id", | ||
"DO_NOT_TRACK_THIS_DEVICE" | ||
], | ||
[ | ||
"grant_type", | ||
"https://oauth.reddit.com/grants/installed_client" | ||
], | ||
[ | ||
"scope", | ||
"adsedit adsread creddits history" | ||
] | ||
], | ||
"headers": { | ||
"AUTHORIZATION": [ | ||
"Basic UGdwOF91NndWWThFS0E6" | ||
], | ||
"Connection": [ | ||
"close" | ||
], | ||
"User-Agent": [ | ||
"asyncprawcore:test (by /u/Lil_SpazJoekp) asyncprawcore/2.2.2.dev0" | ||
] | ||
}, | ||
"method": "POST", | ||
"uri": "https://www.reddit.com/api/v1/access_token" | ||
}, | ||
"response": { | ||
"body": { | ||
"string": "{\"access_token\": \"<ACCESS_TOKEN>\", \"token_type\": \"bearer\", \"device_id\": \"DO_NOT_TRACK_THIS_DEVICE\", \"expires_in\": 3600, \"scope\": \"adsedit adsread creddits history\"}" | ||
}, | ||
"headers": { | ||
"Accept-Ranges": "bytes", | ||
"Cache-Control": "max-age=0, must-revalidate", | ||
"Connection": "close", | ||
"Content-Length": "181", | ||
"Content-Type": "application/json; charset=UTF-8", | ||
"Date": "Tue, 27 Jul 2021 17:46:26 GMT", | ||
"Server": "snooserv", | ||
"Set-Cookie": "edgebucket=OzV3zDfwVNAWIt1kbn; Domain=reddit.com; Max-Age=63071999; Path=/; secure", | ||
"Strict-Transport-Security": "max-age=15552000; includeSubDomains; preload", | ||
"Via": "1.1 varnish", | ||
"X-Clacks-Overhead": "GNU Terry Pratchett", | ||
"X-Moose": "majestic", | ||
"x-content-type-options": "nosniff", | ||
"x-frame-options": "SAMEORIGIN", | ||
"x-ratelimit-remaining": "295", | ||
"x-ratelimit-reset": "214", | ||
"x-ratelimit-used": "5", | ||
"x-reddit-loid": "0000000000dk3rx6vi.2.1627407986872.Z0FBQUFBQmhBRVp5cUNzTnc4d2RxSE1oUUhIcGJTdzl5UmhLak1mQ2djelhoRmtNTGs3Q01tVHFOT2staEhidjJDUzVkWXhTaWVURDltMWkwdFJWbDJLaUppMUVIUEstUlREWnpIOHZWM0pkbi1rdG5tZnY0Qkh2clByaF9YVHNHYTI5b2JkN09qQS0", | ||
"x-xss-protection": "1; mode=block" | ||
}, | ||
"status": { | ||
"code": 200, | ||
"message": "OK" | ||
}, | ||
"url": "https://www.reddit.com/api/v1/access_token" | ||
} | ||
} | ||
], | ||
"recorded_at": "2021-07-27T12:46:30", | ||
"version": 1 | ||
} |
64 changes: 64 additions & 0 deletions
64
tests/cassettes/ReadOnlyAuthorizer_refresh__with_scopes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"interactions": [ | ||
{ | ||
"request": { | ||
"body": [ | ||
[ | ||
"grant_type", | ||
"client_credentials" | ||
], | ||
[ | ||
"scope", | ||
"adsedit adsread creddits history" | ||
] | ||
], | ||
"headers": { | ||
"AUTHORIZATION": [ | ||
"Basic <BASIC_AUTH>" | ||
], | ||
"Connection": [ | ||
"close" | ||
], | ||
"User-Agent": [ | ||
"asyncprawcore:test (by /u/Lil_SpazJoekp) asyncprawcore/2.2.2.dev0" | ||
] | ||
}, | ||
"method": "POST", | ||
"uri": "https://www.reddit.com/api/v1/access_token" | ||
}, | ||
"response": { | ||
"body": { | ||
"string": "{\"access_token\": \"<ACCESS_TOKEN>\", \"token_type\": \"bearer\", \"expires_in\": 3600, \"scope\": \"adsedit adsread creddits history\"}" | ||
}, | ||
"headers": { | ||
"Accept-Ranges": "bytes", | ||
"Cache-Control": "max-age=0, must-revalidate", | ||
"Connection": "close", | ||
"Content-Length": "140", | ||
"Content-Type": "application/json; charset=UTF-8", | ||
"Date": "Tue, 27 Jul 2021 17:45:18 GMT", | ||
"Server": "snooserv", | ||
"Set-Cookie": "edgebucket=62aM61ZBcJl9OkULjg; Domain=reddit.com; Max-Age=63071999; Path=/; secure", | ||
"Strict-Transport-Security": "max-age=15552000; includeSubDomains; preload", | ||
"Via": "1.1 varnish", | ||
"X-Clacks-Overhead": "GNU Terry Pratchett", | ||
"X-Moose": "majestic", | ||
"x-content-type-options": "nosniff", | ||
"x-frame-options": "SAMEORIGIN", | ||
"x-ratelimit-remaining": "297", | ||
"x-ratelimit-reset": "282", | ||
"x-ratelimit-used": "3", | ||
"x-reddit-loid": "0000000000dk3r63pz.2.1627407918395.Z0FBQUFBQmhBRVl1Q2pjdUc1RFkzLV9pby1RekYwVFVKbndjUHJ1OTBaWENtRk9LT21XSmJfaHlmNm9xNnlNWkdfRG1QSWdUWUdZa1dReUZSVEgzTWlmU2VGZ0ZJWFFVRlBNUmJXRVVfc1VVZ0xuQ2lSUGJQdFdpcDZ0eWRnZkFpNGxRNHFkWEZOakw", | ||
"x-xss-protection": "1; mode=block" | ||
}, | ||
"status": { | ||
"code": 200, | ||
"message": "OK" | ||
}, | ||
"url": "https://www.reddit.com/api/v1/access_token" | ||
} | ||
} | ||
], | ||
"recorded_at": "2021-07-27T12:45:21", | ||
"version": 1 | ||
} |
File renamed without changes.
71 changes: 71 additions & 0 deletions
71
tests/cassettes/ScriptAuthorizer_refresh__with_scopes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"interactions": [ | ||
{ | ||
"request": { | ||
"body": [ | ||
[ | ||
"grant_type", | ||
"password" | ||
], | ||
[ | ||
"password", | ||
"<PASSWORD>" | ||
], | ||
[ | ||
"scope", | ||
"adsedit adsread creddits history" | ||
], | ||
[ | ||
"username", | ||
"<USERNAME>" | ||
] | ||
], | ||
"headers": { | ||
"AUTHORIZATION": [ | ||
"Basic <BASIC_AUTH>" | ||
], | ||
"Connection": [ | ||
"close" | ||
], | ||
"User-Agent": [ | ||
"asyncprawcore:test (by /u/Lil_SpazJoekp) asyncprawcore/2.2.2.dev0" | ||
] | ||
}, | ||
"method": "POST", | ||
"uri": "https://www.reddit.com/api/v1/access_token" | ||
}, | ||
"response": { | ||
"body": { | ||
"string": "{\"access_token\": \"<ACCESS_TOKEN>\", \"token_type\": \"bearer\", \"expires_in\": 3600, \"scope\": \"adsedit adsread creddits history\"}" | ||
}, | ||
"headers": { | ||
"Accept-Ranges": "bytes", | ||
"Cache-Control": "max-age=0, must-revalidate", | ||
"Connection": "close", | ||
"Content-Length": "152", | ||
"Content-Type": "application/json; charset=UTF-8", | ||
"Date": "Tue, 27 Jul 2021 17:45:01 GMT", | ||
"Server": "snooserv", | ||
"Set-Cookie": "edgebucket=cXXi2UwmJwuG6dsoFM; Domain=reddit.com; Max-Age=63071999; Path=/; secure", | ||
"Strict-Transport-Security": "max-age=15552000; includeSubDomains; preload", | ||
"Via": "1.1 varnish", | ||
"X-Clacks-Overhead": "GNU Terry Pratchett", | ||
"X-Moose": "majestic", | ||
"x-content-type-options": "nosniff", | ||
"x-frame-options": "SAMEORIGIN", | ||
"x-ratelimit-remaining": "298", | ||
"x-ratelimit-reset": "300", | ||
"x-ratelimit-used": "2", | ||
"x-xss-protection": "1; mode=block" | ||
}, | ||
"status": { | ||
"code": 200, | ||
"message": "OK" | ||
}, | ||
"url": "https://www.reddit.com/api/v1/access_token" | ||
} | ||
} | ||
], | ||
"recorded_at": "2021-07-27T12:45:03", | ||
"version": 1 | ||
} |
File renamed without changes.
Oops, something went wrong.