You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a941898
Browse filesBrowse the repository at this point in the historyBrowse files
fix(token-vault): address review feedback on connection token caching
- Return scope on every cache hit so it matches a fresh result
- Include login_hint in the cache key
- Skip the cache for a non-string sub and treat wrongly typed stored entries as a miss
- Document the organization errors and fix the VerifiedToken usage in the examples
Copy file name to clipboardExpand all lines: EXAMPLES.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -161,10 +161,10 @@ async with httpx.AsyncClient() as client:
161
161
162
162
### With caching
163
163
164
-
Pass a `token_store` to cache the connection token. The SDK caches by `sub` (caller)and `connection`, skipping the exchange on repeat calls for the same userand provider. Pass `verified=` with the result of `verify_access_token()` to reuse that verification rather than running it again inside the exchange.
164
+
Pass a `token_store` to cache the connection token. The SDK caches by `sub` (caller), `connection`and `login_hint`, skipping the exchange on repeat calls for the same user, provider and linked account. Pass `verified=` with a `VerifiedToken` built from the `verify_access_token()` claims to reuse that verification rather than running it again inside the exchange.
165
165
166
166
```python
167
-
from auth0_api_python import ApiClient, ApiClientOptions
167
+
from auth0_api_python import ApiClient, ApiClientOptions, VerifiedToken
168
168
169
169
# token_store is your AbstractTokenStore implementation.
170
170
# See docs/TokenStorage.md for how to build one and for encryption details.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,7 +122,7 @@ async def main():
122
122
asyncio.run(main())
123
123
```
124
124
125
-
When a `token_store` is configured on `ApiClientOptions`, the connection token is cached by callerand connection, skipping the exchange on repeat calls. Pass `verified=` to reuse an already-verified token rather than verifying a second time. See [Access Token for a Connection](EXAMPLES.md#access-token-for-a-connection-token-vault) for a full example and setup requirements.
125
+
When a `token_store` is configured on `ApiClientOptions`, the connection token is cached by caller, connection and `login_hint`, skipping the exchange on repeat calls. Pass `verified=`with a `VerifiedToken` built from the `verify_access_token()` claims to reuse that verification rather than verifying a second time. See [Access Token for a Connection](EXAMPLES.md#access-token-for-a-connection-token-vault) for a full example and setup requirements.
126
126
127
127
More info https://auth0.com/docs/secure/tokens/token-vault
GetAccessTokenForConnectionError: If there was an issue requesting the access token.
753
753
ApiError: If the token exchange endpoint returns an error.
754
754
VerifyAccessTokenError: If a store is configured and either verified is omitted and the token fails verification, or verified is supplied but does not match the access token being exchanged.
755
+
MissingOrganizationError: If a store is configured, verified is omitted, organization_policy is "required" and the token has no org_id claim.
756
+
OrganizationNotAllowedError: If a store is configured, verified is omitted and the token's org_id is not in the organization_id allowlist.
755
757
756
758
Returns:
757
759
Dictionary containing the token response with access_token, expires_in, and scope.
0 commit comments