Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ebf21d6

Browse files
add skip_prompt and fix typings for generate_uri
1 parent 8db2d3d commit ebf21d6

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

‎discordoauth2/__init__.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,12 @@ def revoke_token(self, token: str, token_type: str=None):
256256
else:
257257
raise exceptions.HTTPException(f"Unexpected HTTP {response.status_code}")
258258

259-
def generate_uri(self, scope: Union[str, list[str]], state: Optional[str]=None, response_type: Literal["code", "token"]="code", guild_id=None, disable_guild_select=None, permissions=None) -> str:
259+
def generate_uri(self, scope: Union[str, list[str]], state: Optional[str]=None, skip_prompt: Optional[bool]=False, response_type: Optional[Literal["code", "token"]]="code", guild_id: Optional[Union[int, str]]=None, disable_guild_select: Optional[bool]=None, permissions: Optional[Union[int, str]]=None) -> str:
260260
"""Creates an authorization uri with client information prefilled.
261261
262262
scope: a string, or list of strings for the scope
263263
state: optional state parameter. Optional but recommended.
264+
skip_prompt: doesn't require the end user to reauthorize if they've already authorized you app before. Defaults to `False`.
264265
response_type: either code, or token. token means the server can't access it, but the client can use it without converting.
265266
guild_id: the guild ID to add a bot/webhook.
266267
disable_guild_select: wether to allow the authorizing user to change the selected guild
@@ -271,6 +272,7 @@ def generate_uri(self, scope: Union[str, list[str]], state: Optional[str]=None,
271272
"scope": " ".join(scope) if type(scope) == list else scope,
272273
"state": state,
273274
"redirect_uri": self.redirect_url,
275+
"prompt": "none" if skip_prompt else None,
274276
"response_type": response_type,
275277
"guild_id": guild_id,
276278
"disable_guild_select": disable_guild_select,

‎docs/source/client.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Client
9696

9797
:param Union[str, list[str]] scope: A list, or space-seperated string for the authorization scope
9898
:param Optional[str] state: State parameter. It is recommended for security.
99+
:param Optional[bool] skip_prompt: Doesn't require the end user to reauthorize if they've already authorized you app before. Defaults to ``False``.
99100
:param Optional[Literal["code", "token"]] response_type: either code, or token. token means the server can't access it, but the client can use it without converting.
100101
:param Optional[Union[int, str]] guild_id: the guild ID to add a bot/webhook.
101102
:param Optional[bool] disable_guild_select: wether to allow the authorizing user to change the selected guild

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
setup(
77
name='discord-oauth2.py',
88
description='Use Discord\'s OAuth2 effortlessly! Turns the auth code to a access token and the access token into scope infomation. ',
9-
version="1.2.0",
9+
version="1.2.1",
1010
long_description=long_description,
1111
long_description_content_type="text/markdown",
1212
license='MIT',

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /