From 76ed38d4287a0679526235a71517df81b0199eee Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 6 Oct 2026 15:54:05 +0100 Subject: [PATCH] feat: SDK update for version 24.1.0 Adds the optional state parameter to createOAuth2Token (appwrite/appwrite#14157). --- CHANGELOG.md | 4 ++++ appwrite/client.py | 4 ++-- appwrite/services/account.py | 5 +++++ docs/examples/account/create-o-auth-2-token.md | 3 ++- pyproject.toml | 2 +- setup.py | 4 ++-- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 891eb7bc..29f30f47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 24.1.0 + +* Added: optional `state` parameter on `createOAuth2Token`, returned unchanged on the success and failure URLs + ## 24.0.0 * Stable release of the dedicated database APIs: `mysql`, `postgresql`, `mongo`, `documentsDB`, and `vectorsDB` services, previously released as release candidates diff --git a/appwrite/client.py b/appwrite/client.py index 25cd33cb..da48cc7b 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -18,11 +18,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent': f'AppwritePythonSDK/24.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent': f'AppwritePythonSDK/24.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '24.0.0', + 'x-sdk-version': '24.1.0', 'X-Appwrite-Response-Format': '2.0.0', } self._config = {} diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 0b4ada93..03c7bc39 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -1869,6 +1869,7 @@ def create_o_auth2_token( success: Optional[str] = None, failure: Optional[str] = None, scopes: Optional[List[str]] = None, + state: Optional[str] = None, ) -> str: """ Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. @@ -1887,6 +1888,8 @@ def create_o_auth2_token( URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. scopes : Optional[List[str]] A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. + state : Optional[str] + An opaque value your app generates and keeps, for example in a cookie. It is returned unchanged as the `state` query parameter on the success and failure URLs, so your app can check that the sign-in it receives is one it started. Printable ASCII only (RFC 6749 Appendix A.5). Max length: 256 chars. Returns ------- str @@ -1909,6 +1912,8 @@ def create_o_auth2_token( api_params['failure'] = self._normalize_value(failure) if scopes is not None: api_params['scopes'] = self._normalize_value(scopes) + if state is not None: + api_params['state'] = self._normalize_value(state) response = self.client.call( 'get', diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md index 87f7de0f..cae5a66e 100644 --- a/docs/examples/account/create-o-auth-2-token.md +++ b/docs/examples/account/create-o-auth-2-token.md @@ -14,6 +14,7 @@ result: str = account.create_o_auth2_token( provider = OAuthProvider.AMAZON, success = 'https://example.com', # optional failure = 'https://example.com', # optional - scopes = [] # optional + scopes = [], # optional + state = '' # optional ) ``` diff --git a/pyproject.toml b/pyproject.toml index 1f9a77a9..aee33de5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "appwrite" -version = "24.0.0" +version = "24.1.0" description = "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API" readme = "README.md" requires-python = ">=3.9" diff --git a/setup.py b/setup.py index 1dc69c61..8529f8f9 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name='appwrite', packages=setuptools.find_packages(), - version='24.0.0', + version='24.1.0', license='BSD-3-Clause', description='Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API', long_description=long_description, @@ -18,7 +18,7 @@ maintainer='Appwrite Team', maintainer_email='team@appwrite.io', url='https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/24.0.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/24.1.0.tar.gz', install_requires=[ 'requests', 'pydantic>=2,<3',