Skip to content

Commit fe78d73

Browse files
authored
Merge pull request #114 from MerleLiuKun/feat-confidential
feat(confidential): ✨ make confidetial clients oauth work well
2 parents df9a28f + 5a8fe74 commit fe78d73

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pytwitter/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(
4343
access_token: Optional[str] = None,
4444
access_secret: Optional[str] = None,
4545
client_id: Optional[str] = None,
46+
client_secret: Optional[str] = None,
4647
application_only_auth: bool = False,
4748
oauth_flow: bool = False, # provide access with authorize
4849
sleep_on_rate_limit: bool = False,
@@ -60,6 +61,8 @@ def __init__(
6061
:param access_token: Access token for the authenticated user.
6162
:param access_secret: Access token secret for the authenticated user.
6263
:param client_id: Client ID for app with OAuth2.0
64+
:param client_secret: Client Secret for app with OAuth2.0.
65+
When your app are confidential clients, You need provide this.
6366
:param application_only_auth: If set this, with auto exchange app bearer token with consumer credentials.
6467
:param oauth_flow: If set this, You need generate access token with user by OAuth1.1 or OAuth2.0
6568
:param sleep_on_rate_limit: If token reach the limit, will sleep.
@@ -74,6 +77,7 @@ def __init__(
7477
self.consumer_key = consumer_key
7578
self.consumer_secret = consumer_secret
7679
self.client_id = client_id
80+
self.client_secret = client_secret
7781
self.timeout = timeout
7882
self.proxies = proxies
7983
self.rate_limit = RateLimit()
@@ -321,6 +325,7 @@ def _get_oauth2_session(
321325

322326
session = OAuth2Session(
323327
client_id=self.client_id,
328+
client_secret=self.client_secret,
324329
scope=scope,
325330
redirect_uri=redirect_uri,
326331
code_challenge_method="S256",

0 commit comments

Comments
 (0)