Skip to content

Commit

Permalink
Merge pull request #114 from MerleLiuKun/feat-confidential
Browse files Browse the repository at this point in the history
feat(confidential): ✨ make confidetial clients oauth work well
  • Loading branch information
MerleLiuKun authored Apr 7, 2022
2 parents df9a28f + 5a8fe74 commit fe78d73
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pytwitter/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def __init__(
access_token: Optional[str] = None,
access_secret: Optional[str] = None,
client_id: Optional[str] = None,
client_secret: Optional[str] = None,
application_only_auth: bool = False,
oauth_flow: bool = False, # provide access with authorize
sleep_on_rate_limit: bool = False,
Expand All @@ -60,6 +61,8 @@ def __init__(
:param access_token: Access token for the authenticated user.
:param access_secret: Access token secret for the authenticated user.
:param client_id: Client ID for app with OAuth2.0
:param client_secret: Client Secret for app with OAuth2.0.
When your app are confidential clients, You need provide this.
:param application_only_auth: If set this, with auto exchange app bearer token with consumer credentials.
:param oauth_flow: If set this, You need generate access token with user by OAuth1.1 or OAuth2.0
:param sleep_on_rate_limit: If token reach the limit, will sleep.
Expand All @@ -74,6 +77,7 @@ def __init__(
self.consumer_key = consumer_key
self.consumer_secret = consumer_secret
self.client_id = client_id
self.client_secret = client_secret
self.timeout = timeout
self.proxies = proxies
self.rate_limit = RateLimit()
Expand Down Expand Up @@ -321,6 +325,7 @@ def _get_oauth2_session(

session = OAuth2Session(
client_id=self.client_id,
client_secret=self.client_secret,
scope=scope,
redirect_uri=redirect_uri,
code_challenge_method="S256",
Expand Down

0 comments on commit fe78d73

Please sign in to comment.