Skip to content

Commit 6543363

Browse files
authored
API docs: fix AsyncAuthManagers.basic example (#1110)
The example used an old version of `ExpiringAuth`. Before version 5.9, `ExpiringAuth` accepted an `expires_in` parameter, which then was changed to `expires_at` while `expires_in` was moved to be a convenience method on `ExpiringAuth` instances. However, the example code in `AsyncAuthManagers.basic` was not adjusted.
1 parent 3feed42 commit 6543363

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/neo4j/_async/auth_management.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,12 @@ async def auth_provider():
273273
# assume we know our tokens expire every 60 seconds
274274
expires_in = 60
275275
276-
return ExpiringAuth(
277-
auth=neo4j.bearer_auth(sso_token),
278-
# Include a little buffer so that we fetch a new token
279-
# *before* the old one expires
280-
expires_in=expires_in - 10
281-
)
276+
# Include a little buffer so that we fetch a new token
277+
# *before* the old one expires
278+
expires_in -= 10
279+
280+
auth = neo4j.bearer_auth(sso_token)
281+
return ExpiringAuth(auth=auth).expires_in(expires_in)
282282
283283
284284
with neo4j.GraphDatabase.driver(

src/neo4j/_sync/auth_management.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,12 @@ def auth_provider():
273273
# assume we know our tokens expire every 60 seconds
274274
expires_in = 60
275275
276-
return ExpiringAuth(
277-
auth=neo4j.bearer_auth(sso_token),
278-
# Include a little buffer so that we fetch a new token
279-
# *before* the old one expires
280-
expires_in=expires_in - 10
281-
)
276+
# Include a little buffer so that we fetch a new token
277+
# *before* the old one expires
278+
expires_in -= 10
279+
280+
auth = neo4j.bearer_auth(sso_token)
281+
return ExpiringAuth(auth=auth).expires_in(expires_in)
282282
283283
284284
with neo4j.GraphDatabase.driver(

0 commit comments

Comments
 (0)