diff --git a/examples/async-user-confirmation/langchain-examples/poetry.lock b/examples/async-user-confirmation/langchain-examples/poetry.lock index fb84438..dfcc105 100644 --- a/examples/async-user-confirmation/langchain-examples/poetry.lock +++ b/examples/async-user-confirmation/langchain-examples/poetry.lock @@ -223,7 +223,7 @@ files = [] develop = true [package.dependencies] -auth0-python = "^4.12.0" +auth0-python = "^4.13.0" openfga-sdk = "^0.9.5" [package.source] @@ -254,14 +254,14 @@ url = "../../../packages/auth0-ai-langchain" [[package]] name = "auth0-python" -version = "4.12.0" +version = "4.13.0" description = "" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "auth0_python-4.12.0-py3-none-any.whl", hash = "sha256:3a9c13e79ccb93ed26d000ab2cadbba1eb1cfb7724ff008bbdb694437d35ec04"}, - {file = "auth0_python-4.12.0.tar.gz", hash = "sha256:eb8c91dc5b8b12695affbcb37d74420eab35c91246036c83ed786b7ab9d5f292"}, + {file = "auth0_python-4.13.0-py3-none-any.whl", hash = "sha256:8e3266fcfc2e3cc4f477e01f964c0a6c9a3563653a2feb226355bc825cd4932c"}, + {file = "auth0_python-4.13.0.tar.gz", hash = "sha256:72f58bd26b078e3b493e4d24928cc75fa41842aae35cef488ed6f8db0fb701fb"}, ] [package.dependencies] diff --git a/examples/async-user-confirmation/llama-index-examples/poetry.lock b/examples/async-user-confirmation/llama-index-examples/poetry.lock index 3c14e91..831661f 100644 --- a/examples/async-user-confirmation/llama-index-examples/poetry.lock +++ b/examples/async-user-confirmation/llama-index-examples/poetry.lock @@ -229,7 +229,7 @@ files = [] develop = true [package.dependencies] -auth0-python = "^4.12.0" +auth0-python = "^4.13.0" openfga-sdk = "^0.9.5" [package.source] @@ -257,14 +257,14 @@ url = "../../../packages/auth0-ai-llamaindex" [[package]] name = "auth0-python" -version = "4.12.0" +version = "4.13.0" description = "" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "auth0_python-4.12.0-py3-none-any.whl", hash = "sha256:3a9c13e79ccb93ed26d000ab2cadbba1eb1cfb7724ff008bbdb694437d35ec04"}, - {file = "auth0_python-4.12.0.tar.gz", hash = "sha256:eb8c91dc5b8b12695affbcb37d74420eab35c91246036c83ed786b7ab9d5f292"}, + {file = "auth0_python-4.13.0-py3-none-any.whl", hash = "sha256:8e3266fcfc2e3cc4f477e01f964c0a6c9a3563653a2feb226355bc825cd4932c"}, + {file = "auth0_python-4.13.0.tar.gz", hash = "sha256:72f58bd26b078e3b493e4d24928cc75fa41842aae35cef488ed6f8db0fb701fb"}, ] [package.dependencies] diff --git a/examples/async-user-confirmation/sample-api/poetry.lock b/examples/async-user-confirmation/sample-api/poetry.lock index 103bda2..f430f2d 100644 --- a/examples/async-user-confirmation/sample-api/poetry.lock +++ b/examples/async-user-confirmation/sample-api/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.4 and should not be changed by hand. [[package]] name = "blinker" @@ -14,14 +14,14 @@ files = [ [[package]] name = "click" -version = "8.1.8" +version = "8.2.1" description = "Composable command line interface toolkit" optional = false -python-versions = ">=3.7" +python-versions = ">=3.10" groups = ["main"] files = [ - {file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"}, - {file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"}, + {file = "click-8.2.1-py3-none-any.whl", hash = "sha256:61a3265b914e850b85317d0b3109c7f8cd35a670f963866005d6ef1d5175a12b"}, + {file = "click-8.2.1.tar.gz", hash = "sha256:27c491cc05d968d271d5a1db13e3b5a184636d9d930f148c50b038f0d0646202"}, ] [package.dependencies] @@ -42,14 +42,14 @@ files = [ [[package]] name = "ecdsa" -version = "0.19.0" +version = "0.19.1" description = "ECDSA cryptographic signature library (pure python)" optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.6" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.6" groups = ["main"] files = [ - {file = "ecdsa-0.19.0-py2.py3-none-any.whl", hash = "sha256:2cea9b88407fdac7bbeca0833b189e4c9c53f2ef1e1eaa29f6224dbc809b707a"}, - {file = "ecdsa-0.19.0.tar.gz", hash = "sha256:60eaad1199659900dd0af521ed462b793bbdf867432b3948e87416ae4caf6bf8"}, + {file = "ecdsa-0.19.1-py2.py3-none-any.whl", hash = "sha256:30638e27cf77b7e15c4c4cc1973720149e1033827cfd00661ca5c8cc0cdb24c3"}, + {file = "ecdsa-0.19.1.tar.gz", hash = "sha256:478cba7b62555866fcb3bb3fe985e06decbdb68ef55713c4e5ab98c57d508e61"}, ] [package.dependencies] @@ -61,14 +61,14 @@ gmpy2 = ["gmpy2"] [[package]] name = "flask" -version = "3.1.1" +version = "3.1.2" description = "A simple framework for building complex web applications." optional = false python-versions = ">=3.9" groups = ["main"] files = [ - {file = "flask-3.1.1-py3-none-any.whl", hash = "sha256:07aae2bb5eaf77993ef57e357491839f5fd9f4dc281593a81a9e4d79a24f295c"}, - {file = "flask-3.1.1.tar.gz", hash = "sha256:284c7b8f2f58cb737f0cf1c30fd7eaf0ccfcde196099d24ecede3fc2005aa59e"}, + {file = "flask-3.1.2-py3-none-any.whl", hash = "sha256:ca1d8112ec8a6158cc29ea4858963350011b5c846a414cdb7a954aa9e967d03c"}, + {file = "flask-3.1.2.tar.gz", hash = "sha256:bf656c15c80190ed628ad08cdfd3aaa35beb087855e2f494910aa3774cc4fd87"}, ] [package.dependencies] @@ -113,14 +113,14 @@ files = [ [[package]] name = "jinja2" -version = "3.1.5" +version = "3.1.6" description = "A very fast and expressive template engine." optional = false python-versions = ">=3.7" groups = ["main"] files = [ - {file = "jinja2-3.1.5-py3-none-any.whl", hash = "sha256:aba0f4dc9ed8013c424088f68a5c226f7d6097ed89b246d7749c2ec4175c6adb"}, - {file = "jinja2-3.1.5.tar.gz", hash = "sha256:8fefff8dc3034e27bb80d67c671eb8a9bc424c0ef4c0826edbff304cceff43bb"}, + {file = "jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"}, + {file = "jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"}, ] [package.dependencies] @@ -252,14 +252,14 @@ test = ["pytest", "pytest-cov"] [[package]] name = "rsa" -version = "4.9" +version = "4.9.1" description = "Pure-Python RSA implementation" optional = false -python-versions = ">=3.6,<4" +python-versions = "<4,>=3.6" groups = ["main"] files = [ - {file = "rsa-4.9-py3-none-any.whl", hash = "sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7"}, - {file = "rsa-4.9.tar.gz", hash = "sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21"}, + {file = "rsa-4.9.1-py3-none-any.whl", hash = "sha256:68635866661c6836b8d39430f97a996acbd61bfa49406748ea243539fe239762"}, + {file = "rsa-4.9.1.tar.gz", hash = "sha256:e7bdbfdb5497da4c07dfd35530e1a902659db6ff241e39d9953cad06ebd0ae75"}, ] [package.dependencies] diff --git a/examples/authorization-for-rag/langchain-examples/poetry.lock b/examples/authorization-for-rag/langchain-examples/poetry.lock index 468116f..f744ed1 100644 --- a/examples/authorization-for-rag/langchain-examples/poetry.lock +++ b/examples/authorization-for-rag/langchain-examples/poetry.lock @@ -195,7 +195,7 @@ files = [] develop = true [package.dependencies] -auth0-python = "^4.12.0" +auth0-python = "^4.13.0" openfga-sdk = "^0.9.5" [package.source] @@ -226,14 +226,14 @@ url = "../../../packages/auth0-ai-langchain" [[package]] name = "auth0-python" -version = "4.12.0" +version = "4.13.0" description = "" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "auth0_python-4.12.0-py3-none-any.whl", hash = "sha256:3a9c13e79ccb93ed26d000ab2cadbba1eb1cfb7724ff008bbdb694437d35ec04"}, - {file = "auth0_python-4.12.0.tar.gz", hash = "sha256:eb8c91dc5b8b12695affbcb37d74420eab35c91246036c83ed786b7ab9d5f292"}, + {file = "auth0_python-4.13.0-py3-none-any.whl", hash = "sha256:8e3266fcfc2e3cc4f477e01f964c0a6c9a3563653a2feb226355bc825cd4932c"}, + {file = "auth0_python-4.13.0.tar.gz", hash = "sha256:72f58bd26b078e3b493e4d24928cc75fa41842aae35cef488ed6f8db0fb701fb"}, ] [package.dependencies] diff --git a/examples/authorization-for-rag/llama-index-examples/poetry.lock b/examples/authorization-for-rag/llama-index-examples/poetry.lock index 6fde8fa..13b2fbc 100644 --- a/examples/authorization-for-rag/llama-index-examples/poetry.lock +++ b/examples/authorization-for-rag/llama-index-examples/poetry.lock @@ -214,7 +214,7 @@ files = [] develop = true [package.dependencies] -auth0-python = "^4.12.0" +auth0-python = "^4.13.0" openfga-sdk = "^0.9.5" [package.source] @@ -242,14 +242,14 @@ url = "../../../packages/auth0-ai-llamaindex" [[package]] name = "auth0-python" -version = "4.12.0" +version = "4.13.0" description = "" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "auth0_python-4.12.0-py3-none-any.whl", hash = "sha256:3a9c13e79ccb93ed26d000ab2cadbba1eb1cfb7724ff008bbdb694437d35ec04"}, - {file = "auth0_python-4.12.0.tar.gz", hash = "sha256:eb8c91dc5b8b12695affbcb37d74420eab35c91246036c83ed786b7ab9d5f292"}, + {file = "auth0_python-4.13.0-py3-none-any.whl", hash = "sha256:8e3266fcfc2e3cc4f477e01f964c0a6c9a3563653a2feb226355bc825cd4932c"}, + {file = "auth0_python-4.13.0.tar.gz", hash = "sha256:72f58bd26b078e3b493e4d24928cc75fa41842aae35cef488ed6f8db0fb701fb"}, ] [package.dependencies] diff --git a/examples/authorization-for-tools/langchain-examples/poetry.lock b/examples/authorization-for-tools/langchain-examples/poetry.lock index 992a9bc..4991bfe 100644 --- a/examples/authorization-for-tools/langchain-examples/poetry.lock +++ b/examples/authorization-for-tools/langchain-examples/poetry.lock @@ -195,7 +195,7 @@ files = [] develop = true [package.dependencies] -auth0-python = "^4.12.0" +auth0-python = "^4.13.0" openfga-sdk = "^0.9.5" [package.source] @@ -226,14 +226,14 @@ url = "../../../packages/auth0-ai-langchain" [[package]] name = "auth0-python" -version = "4.12.0" +version = "4.13.0" description = "" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "auth0_python-4.12.0-py3-none-any.whl", hash = "sha256:3a9c13e79ccb93ed26d000ab2cadbba1eb1cfb7724ff008bbdb694437d35ec04"}, - {file = "auth0_python-4.12.0.tar.gz", hash = "sha256:eb8c91dc5b8b12695affbcb37d74420eab35c91246036c83ed786b7ab9d5f292"}, + {file = "auth0_python-4.13.0-py3-none-any.whl", hash = "sha256:8e3266fcfc2e3cc4f477e01f964c0a6c9a3563653a2feb226355bc825cd4932c"}, + {file = "auth0_python-4.13.0.tar.gz", hash = "sha256:72f58bd26b078e3b493e4d24928cc75fa41842aae35cef488ed6f8db0fb701fb"}, ] [package.dependencies] diff --git a/examples/authorization-for-tools/llama-index-examples/poetry.lock b/examples/authorization-for-tools/llama-index-examples/poetry.lock index bea94e7..559f2b5 100644 --- a/examples/authorization-for-tools/llama-index-examples/poetry.lock +++ b/examples/authorization-for-tools/llama-index-examples/poetry.lock @@ -214,7 +214,7 @@ files = [] develop = true [package.dependencies] -auth0-python = "^4.12.0" +auth0-python = "^4.13.0" openfga-sdk = "^0.9.5" [package.source] @@ -242,14 +242,14 @@ url = "../../../packages/auth0-ai-llamaindex" [[package]] name = "auth0-python" -version = "4.12.0" +version = "4.13.0" description = "" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "auth0_python-4.12.0-py3-none-any.whl", hash = "sha256:3a9c13e79ccb93ed26d000ab2cadbba1eb1cfb7724ff008bbdb694437d35ec04"}, - {file = "auth0_python-4.12.0.tar.gz", hash = "sha256:eb8c91dc5b8b12695affbcb37d74420eab35c91246036c83ed786b7ab9d5f292"}, + {file = "auth0_python-4.13.0-py3-none-any.whl", hash = "sha256:8e3266fcfc2e3cc4f477e01f964c0a6c9a3563653a2feb226355bc825cd4932c"}, + {file = "auth0_python-4.13.0.tar.gz", hash = "sha256:72f58bd26b078e3b493e4d24928cc75fa41842aae35cef488ed6f8db0fb701fb"}, ] [package.dependencies] diff --git a/examples/calling-apis/langchain-examples/poetry.lock b/examples/calling-apis/langchain-examples/poetry.lock index 3455acc..4fa0888 100644 --- a/examples/calling-apis/langchain-examples/poetry.lock +++ b/examples/calling-apis/langchain-examples/poetry.lock @@ -195,7 +195,7 @@ files = [] develop = true [package.dependencies] -auth0-python = "^4.12.0" +auth0-python = "^4.13.0" openfga-sdk = "^0.9.5" [package.source] @@ -243,14 +243,14 @@ itsdangerous = ">=2.2.0,<3.0.0" [[package]] name = "auth0-python" -version = "4.12.0" +version = "4.13.0" description = "" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "auth0_python-4.12.0-py3-none-any.whl", hash = "sha256:3a9c13e79ccb93ed26d000ab2cadbba1eb1cfb7724ff008bbdb694437d35ec04"}, - {file = "auth0_python-4.12.0.tar.gz", hash = "sha256:eb8c91dc5b8b12695affbcb37d74420eab35c91246036c83ed786b7ab9d5f292"}, + {file = "auth0_python-4.13.0-py3-none-any.whl", hash = "sha256:8e3266fcfc2e3cc4f477e01f964c0a6c9a3563653a2feb226355bc825cd4932c"}, + {file = "auth0_python-4.13.0.tar.gz", hash = "sha256:72f58bd26b078e3b493e4d24928cc75fa41842aae35cef488ed6f8db0fb701fb"}, ] [package.dependencies] diff --git a/examples/calling-apis/llama-index-examples/poetry.lock b/examples/calling-apis/llama-index-examples/poetry.lock index 5505bd8..c7ffae6 100644 --- a/examples/calling-apis/llama-index-examples/poetry.lock +++ b/examples/calling-apis/llama-index-examples/poetry.lock @@ -235,7 +235,7 @@ files = [] develop = true [package.dependencies] -auth0-python = "^4.12.0" +auth0-python = "^4.13.0" openfga-sdk = "^0.9.5" [package.source] @@ -263,14 +263,14 @@ url = "../../../packages/auth0-ai-llamaindex" [[package]] name = "auth0-python" -version = "4.12.0" +version = "4.13.0" description = "" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "auth0_python-4.12.0-py3-none-any.whl", hash = "sha256:3a9c13e79ccb93ed26d000ab2cadbba1eb1cfb7724ff008bbdb694437d35ec04"}, - {file = "auth0_python-4.12.0.tar.gz", hash = "sha256:eb8c91dc5b8b12695affbcb37d74420eab35c91246036c83ed786b7ab9d5f292"}, + {file = "auth0_python-4.13.0-py3-none-any.whl", hash = "sha256:8e3266fcfc2e3cc4f477e01f964c0a6c9a3563653a2feb226355bc825cd4932c"}, + {file = "auth0_python-4.13.0.tar.gz", hash = "sha256:72f58bd26b078e3b493e4d24928cc75fa41842aae35cef488ed6f8db0fb701fb"}, ] [package.dependencies] diff --git a/packages/auth0-ai-langchain/poetry.lock b/packages/auth0-ai-langchain/poetry.lock index f8c29b6..c6ec3b0 100644 --- a/packages/auth0-ai-langchain/poetry.lock +++ b/packages/auth0-ai-langchain/poetry.lock @@ -195,7 +195,7 @@ files = [] develop = true [package.dependencies] -auth0-python = "^4.12.0" +auth0-python = "^4.13.0" openfga-sdk = "^0.9.5" [package.source] @@ -204,14 +204,14 @@ url = "../auth0-ai" [[package]] name = "auth0-python" -version = "4.12.0" +version = "4.13.0" description = "" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "auth0_python-4.12.0-py3-none-any.whl", hash = "sha256:3a9c13e79ccb93ed26d000ab2cadbba1eb1cfb7724ff008bbdb694437d35ec04"}, - {file = "auth0_python-4.12.0.tar.gz", hash = "sha256:eb8c91dc5b8b12695affbcb37d74420eab35c91246036c83ed786b7ab9d5f292"}, + {file = "auth0_python-4.13.0-py3-none-any.whl", hash = "sha256:8e3266fcfc2e3cc4f477e01f964c0a6c9a3563653a2feb226355bc825cd4932c"}, + {file = "auth0_python-4.13.0.tar.gz", hash = "sha256:72f58bd26b078e3b493e4d24928cc75fa41842aae35cef488ed6f8db0fb701fb"}, ] [package.dependencies] diff --git a/packages/auth0-ai-llamaindex/poetry.lock b/packages/auth0-ai-llamaindex/poetry.lock index 47c0cc4..4ba47a0 100644 --- a/packages/auth0-ai-llamaindex/poetry.lock +++ b/packages/auth0-ai-llamaindex/poetry.lock @@ -218,7 +218,7 @@ files = [] develop = true [package.dependencies] -auth0-python = "^4.12.0" +auth0-python = "^4.13.0" openfga-sdk = "^0.9.5" [package.source] @@ -227,14 +227,14 @@ url = "../auth0-ai" [[package]] name = "auth0-python" -version = "4.12.0" +version = "4.13.0" description = "" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "auth0_python-4.12.0-py3-none-any.whl", hash = "sha256:3a9c13e79ccb93ed26d000ab2cadbba1eb1cfb7724ff008bbdb694437d35ec04"}, - {file = "auth0_python-4.12.0.tar.gz", hash = "sha256:eb8c91dc5b8b12695affbcb37d74420eab35c91246036c83ed786b7ab9d5f292"}, + {file = "auth0_python-4.13.0-py3-none-any.whl", hash = "sha256:8e3266fcfc2e3cc4f477e01f964c0a6c9a3563653a2feb226355bc825cd4932c"}, + {file = "auth0_python-4.13.0.tar.gz", hash = "sha256:72f58bd26b078e3b493e4d24928cc75fa41842aae35cef488ed6f8db0fb701fb"}, ] [package.dependencies] diff --git a/packages/auth0-ai/auth0_ai/authorizers/ciba/ciba_authorizer_base.py b/packages/auth0-ai/auth0_ai/authorizers/ciba/ciba_authorizer_base.py index 16e3afd..39c5a09 100644 --- a/packages/auth0-ai/auth0_ai/authorizers/ciba/ciba_authorizer_base.py +++ b/packages/auth0-ai/auth0_ai/authorizers/ciba/ciba_authorizer_base.py @@ -154,6 +154,31 @@ async def _start(self, authorize_params) -> CIBAAuthorizationRequest: else: raise + def _extract_retry_after_header(self, error: Auth0Error) -> Optional[int]: + """ + Extract the Retry-After header value from an Auth0Error. + + Args: + error: The Auth0Error object that may contain HTTP headers + + Returns: + The retry-after value in seconds as an integer, or None if not present + """ + + if not hasattr(error, 'headers') or not error.headers: + return None + + retry_after = error.headers.get('retry-after') or error.headers.get('Retry-After') + + if retry_after is None: + return None + + try: + return int(retry_after) + except (ValueError, TypeError): + # If the retry-after value is not a valid integer, return None + return None + def _get_credentials_internal(self, auth_request: CIBAAuthorizationRequest) -> TokenResponse | None: try: # Calculate elapsed time in seconds @@ -180,7 +205,8 @@ def _get_credentials_internal(self, auth_request: CIBAAuthorizationRequest) -> T raise AuthorizationPendingInterrupt(e.message, auth_request) if e.error_code == "slow_down": - raise AuthorizationPollingInterrupt(e.message, auth_request) + retry_after = self._extract_retry_after_header(e) + raise AuthorizationPollingInterrupt(e.message, auth_request, retry_after) if e.error_code == "invalid_grant": raise InvalidGrantInterrupt(e.message, auth_request) @@ -203,7 +229,7 @@ async def get_credentials_polling(self, auth_request: CIBAAuthorizationRequest) try: credentials = self._get_credentials_internal(auth_request) except (AuthorizationPendingInterrupt, AuthorizationPollingInterrupt) as err: - await asyncio.sleep(err.request["interval"]) + await asyncio.sleep(err.next_retry_interval()) except Exception: raise diff --git a/packages/auth0-ai/auth0_ai/interrupts/ciba_interrupts.py b/packages/auth0-ai/auth0_ai/interrupts/ciba_interrupts.py index 74fce6a..7277dbb 100644 --- a/packages/auth0-ai/auth0_ai/interrupts/ciba_interrupts.py +++ b/packages/auth0-ai/auth0_ai/interrupts/ciba_interrupts.py @@ -76,13 +76,24 @@ def __init__(self, message: str, request: CIBAAuthorizationRequest): CIBAInterrupt.__init__(self, message, AuthorizationPendingInterrupt.code) WithRequestData.__init__(self, request) + def next_retry_interval(self) -> int: + """Return the interval in seconds to wait before the next retry attempt.""" + return self.request["interval"] + class AuthorizationPollingInterrupt(CIBAInterrupt, WithRequestData): code: str = "CIBA_AUTHORIZATION_POLLING_ERROR" - def __init__(self, message: str, request: CIBAAuthorizationRequest): + def __init__(self, message: str, request: CIBAAuthorizationRequest, retry_after: int = None): Auth0Interrupt.__init__(self, message, AuthorizationPollingInterrupt.code) WithRequestData.__init__(self, request) + self.retry_after = retry_after + + def next_retry_interval(self) -> int: + """Return the interval in seconds to wait before the next retry attempt.""" + # Use the retry_after value from the HTTP header if available, + # otherwise fall back to the original interval from the auth request + return self.retry_after if self.retry_after is not None else self.request["interval"] class InvalidGrantInterrupt(CIBAInterrupt, WithRequestData): diff --git a/packages/auth0-ai/poetry.lock b/packages/auth0-ai/poetry.lock index 479ba81..f6f9a6f 100644 --- a/packages/auth0-ai/poetry.lock +++ b/packages/auth0-ai/poetry.lock @@ -152,14 +152,14 @@ tests-mypy = ["mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" a [[package]] name = "auth0-python" -version = "4.12.0" +version = "4.13.0" description = "" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "auth0_python-4.12.0-py3-none-any.whl", hash = "sha256:3a9c13e79ccb93ed26d000ab2cadbba1eb1cfb7724ff008bbdb694437d35ec04"}, - {file = "auth0_python-4.12.0.tar.gz", hash = "sha256:eb8c91dc5b8b12695affbcb37d74420eab35c91246036c83ed786b7ab9d5f292"}, + {file = "auth0_python-4.13.0-py3-none-any.whl", hash = "sha256:8e3266fcfc2e3cc4f477e01f964c0a6c9a3563653a2feb226355bc825cd4932c"}, + {file = "auth0_python-4.13.0.tar.gz", hash = "sha256:72f58bd26b078e3b493e4d24928cc75fa41842aae35cef488ed6f8db0fb701fb"}, ] [package.dependencies] @@ -1652,4 +1652,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.1" python-versions = "^3.11" -content-hash = "660da42cae04c2ec7865db61ed87bc418570dbc2fe7f84d2b94d8483a1769a86" +content-hash = "de26ec22af008b60277b664c932d868d2bfd15351e92ee2fc4e5ae6fbfb42e9c" diff --git a/packages/auth0-ai/pyproject.toml b/packages/auth0-ai/pyproject.toml index 730be4a..3e91c70 100644 --- a/packages/auth0-ai/pyproject.toml +++ b/packages/auth0-ai/pyproject.toml @@ -10,7 +10,7 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.11" openfga-sdk = "^0.9.5" -auth0-python = "^4.12.0" +auth0-python = "^4.13.0" [tool.poetry.group.dev.dependencies] twine = "^6.1.0"