|
3 | 3 | Working with Refresh Tokens |
4 | 4 | =========================== |
5 | 5 |
|
6 | | -.. note:: |
7 | | - |
8 | | - The process for using refresh tokens is in the process of changing on Reddit's end. |
9 | | - This documentation has been updated to be aligned with the future of how Reddit |
10 | | - handles refresh tokens, and will be the only supported method in PRAW 8+. For more |
11 | | - information please see: |
12 | | - https://old.reddit.com/r/redditdev/comments/kvzaot/oauth2_api_changes_upcoming/ |
13 | | - |
14 | 6 | Reddit OAuth2 Scopes |
15 | 7 | -------------------- |
16 | 8 |
|
@@ -82,33 +74,3 @@ The following program can be used to obtain a refresh token with the desired sco |
82 | 74 |
|
83 | 75 | .. literalinclude:: ../examples/obtain_refresh_token.py |
84 | 76 | :language: python |
85 | | - |
86 | | -.. _using_refresh_tokens: |
87 | | - |
88 | | -Using and Updating Refresh Tokens |
89 | | ---------------------------------- |
90 | | - |
91 | | -Reddit refresh tokens can be used only once. When an authorization is refreshed the |
92 | | -existing refresh token is consumed and a new access token and refresh token will be |
93 | | -issued. While PRAW automatically handles refreshing tokens when needed, it does not |
94 | | -automatically handle the storage of the refresh tokens. However, PRAW provides the |
95 | | -facilities for you to manage your refresh tokens via custom subclasses of |
96 | | -:class:`.BaseTokenManager`. For trivial examples, PRAW provides the |
97 | | -:class:`.FileTokenManager`. |
98 | | - |
99 | | -The following program demonstrates how to prepare a file with an initial refresh token, |
100 | | -and configure PRAW to both use that refresh token, and keep the file up-to-date with a |
101 | | -valid refresh token. |
102 | | - |
103 | | -.. literalinclude:: ../examples/use_file_token_manager.py |
104 | | - :language: python |
105 | | - |
106 | | -.. _sqlite_token_manager: |
107 | | - |
108 | | -SQLiteTokenManager |
109 | | -~~~~~~~~~~~~~~~~~~ |
110 | | - |
111 | | -For more complex examples, PRAW provides the :class:`.SQLiteTokenManager`. |
112 | | - |
113 | | -.. literalinclude:: ../examples/use_sqlite_token_manager.py |
114 | | - :language: python |
0 commit comments