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
-[Authenticating with a application configured to use `private_key_jwt` token endpoint auth method](#authenticating-with-a-application-configured-to-use-private-key-jwt-token-endpoint-auth-method)
6
6
-[Management SDK](#management-sdk)
7
7
-[Connections](#connections)
8
8
-[Error handling](#error-handling)
@@ -32,7 +32,7 @@ For symmetric algorithms like HS256, use the `SymmetricSignatureVerifier` class,
32
32
The following example demonstrates the verification of an ID token signed with the RS256 signing algorithm:
33
33
34
34
```python
35
-
from auth0.v3.authentication.token_verifierimport TokenVerifier, AsymmetricSignatureVerifier
35
+
from auth0.authentication import TokenVerifier, AsymmetricSignatureVerifier
36
36
37
37
domain ='myaccount.auth0.com'
38
38
client_id ='exampleid'
@@ -50,102 +50,26 @@ tv.verify(id_token)
50
50
51
51
If the token verification fails, a `TokenValidationError` will be raised. In that scenario, the ID token should be deemed invalid and its contents should not be trusted.
52
52
53
-
54
-
55
-
### Organizations
56
-
57
-
[Organizations](https://auth0.com/docs/organizations) is a set of features that provide better support for developers who build and maintain SaaS and Business-to-Business (B2B) applications.
58
-
59
-
Note that Organizations is currently only available to customers on our Enterprise and Startup subscription plans.
60
-
61
-
62
-
#### Log in to an organization
63
-
64
-
Log in to an organization by specifying the ``organization`` property when calling ``authorize()``:
65
-
66
-
```python
67
-
from auth0.v3.authentication.authorize_client import AuthorizeClient
68
-
69
-
client = AuthorizeClient('my.domain.com')
70
-
71
-
client.authorize(client_id='client_id',
72
-
redirect_uri='http://localhost',
73
-
organization="org_abc")
74
-
```
75
-
76
-
When logging into an organization, it is important to ensure the `org_id` claim of the ID Token matches the expected organization value. The `TokenVerifier` can be be used to ensure the ID Token contains the expected `org_id` claim value:
53
+
### Authenticating with a application configured to use `private_key_jwt` token endpoint auth method
77
54
78
55
```python
79
-
from auth0.v3.authentication.token_verifier import TokenVerifier, AsymmetricSignatureVerifier
tv = TokenVerifier(signature_verifier=sv, issuer=issuer, audience=client_id)
92
-
93
-
# pass the expected organization the user logged in to:
94
-
tv.verify(id_token, organization='org_abc')
95
-
96
-
```
97
-
98
-
#### Accept user invitations
99
-
100
-
Accept a user invitation by specifying the `invitation` property when calling `authorize()`. Note that you must also specify the ``organization`` if providing an ``invitation``.
101
-
The ID of the invitation and organization are available as query parameters on the invitation URL, e.g., ``https://your-domain.auth0.com/login?invitation=invitation_id&organization=org_id&organization_name=org_name``
102
-
103
-
```python
104
-
from auth0.v3.authentication.authorize_client import AuthorizeClient
105
-
106
-
client = AuthorizeClient('my.domain.com')
107
-
108
-
client.authorize(client_id='client_id',
109
-
redirect_uri='http://localhost',
110
-
organization='org_abc',
111
-
invitation="invitation_123")
112
-
```
113
-
114
-
#### Authorizing users from an Organization
115
-
116
-
If an `org_id` claim is present in the Access Token, then the claim should be validated by the API to ensure that the value received is expected or known.
117
-
118
-
In particular:
119
-
120
-
- The issuer (`iss`) claim should be checked to ensure the token was issued by Auth0
121
-
- The organization ID (`org_id`) claim should be checked to ensure it is a value that is already known to the application. This could be validated against a known list of organization IDs, or perhaps checked in conjunction with the current request URL. e.g. the sub-domain may hint at what organization should be used to validate the Access Token.
122
-
123
-
Normally, validating the issuer would be enough to ensure that the token was issued by Auth0. In the case of organizations, additional checks should be made so that the organization within an Auth0 tenant is expected.
124
-
125
-
If the claim cannot be validated, then the application should deem the token invalid.
126
-
127
-
The snippet below attempts to illustrate how this verification could look like using the external [PyJWT](https://pyjwt.readthedocs.io/en/latest/usage.html#encoding-decoding-tokens-with-rs256-rsa) library. This dependency will take care of pulling the RS256 Public Key that was used by the server to sign the Access Token. It will also validate its signature, expiration, and the audience value. After the basic verification, get the `org_id` claim and check it against the expected value. The code assumes your application is configured to sign tokens using the RS256 algorithm. Check the [Validate JSON Web Tokens](https://auth0.com/docs/tokens/json-web-tokens/validate-json-web-tokens) article to learn more about this verification.
# if this line is reached, validation is successful
149
73
```
150
74
151
75
## Management SDK
@@ -221,29 +145,29 @@ resets is exposed in the `reset_at` property. When the header is unset, this val
221
145
222
146
### Asynchronous environments
223
147
224
-
This SDK provides async methods built on top of [asyncio](https://docs.python.org/3/library/asyncio.html). To make them available you must have Python >=3.6 and the [aiohttp](https://docs.aiohttp.org/en/stable/) module installed.
148
+
This SDK provides async methods built on top of [asyncio](https://docs.python.org/3/library/asyncio.html). To make them available you must have the [aiohttp](https://docs.aiohttp.org/en/stable/) module installed.
225
149
226
150
Then additional methods with the `_async` suffix will be added to modules created by the `management.Auth0` class or to classes that are passed to the `asyncify` method. For example:
227
151
228
152
```python
229
153
import asyncio
230
154
import aiohttp
231
-
from auth0.v3.asyncify import asyncify
232
-
from auth0.v3.management import Auth0, Users, Connections
233
-
from auth0.v3.authentication import Users as AuthUsers
155
+
from auth0.asyncify import asyncify
156
+
from auth0.management import Auth0, Users, Connections
157
+
from auth0.authentication import Users as AuthUsers
234
158
235
159
auth0 = Auth0('domain', 'mgmt_api_token')
236
160
161
+
237
162
asyncdefmain():
238
163
# users = auth0.users.all() <= sync
239
-
users =await auth0.users.all_async() # <= async
164
+
users =await auth0.users.all_async() # <= async
240
165
241
166
# To share a session amongst multiple calls to the same service
242
167
asyncwith auth0.users as users:
243
168
data =await users.get_async(id)
244
169
users.update_async(id, data)
245
170
246
-
247
171
# To share a session amongst multiple calls to multiple services
248
172
asyncwith Auth0('domain', 'mgmt_api_token') as auth0:
If you need to authenticate a user using their email and password, you can use the `GetToken` object, which enables making requests to the `/oauth/token` endpoint.
To use the management library you will need to instantiate an Auth0 object with a domain and a [Management API v2 token](https://auth0.com/docs/api/management/v2/tokens). Please note that these token last 24 hours, so if you need it constantly you should ask for it programmatically using the client credentials grant with a [non interactive client](https://auth0.com/docs/api/management/v2/tokens#1-create-and-authorize-a-client) authorized to access the API. For example:
@@ -140,6 +135,33 @@ For more code samples on how to integrate the auth0-python SDK in your Python ap
140
135
- UserBlocks() (`Auth0().user_blocks` )
141
136
- UsersByEmail() ( `Auth0().users_by_email` )
142
137
- Users() ( `Auth0().users` )
138
+
139
+
## Support Policy
140
+
141
+
Our support lifecycle policy mirrors the [Python support schedule](https://devguide.python.org/versions/). We do not support running the SDK on unsupported versions of Python that have ceased to receive security updates. Please ensure your environment remains up to date and running the latest Python version possible.
142
+
143
+
| SDK Version | Python Version | Support Ends |
144
+
|-------------| -------------- | ------------ |
145
+
| 4.x | 3.11 | Oct 2027 |
146
+
|| 3.10 | Oct 2026 |
147
+
|| 3.9 | Oct 2025 |
148
+
|| 3.8 | Oct 2024 |
149
+
|| 3.7 | Oct 2023 |
150
+
151
+
> As `pip`[reliably avoids](https://packaging.python.org/en/latest/tutorials/packaging-projects/#configuring-metadata) installing package updates that target incompatible Python versions, we may opt to remove support for [end-of-life](https://en.wikipedia.org/wiki/CPython#Version_history) Python versions during minor SDK updates. These are not considered breaking changes by this SDK.
152
+
153
+
The following is a list of unsupported Python versions, and the last SDK version supporting them:
154
+
155
+
| Python Version | Last SDK Version Supporting |
156
+
| -------------- |-----------------------------|
157
+
| >= 2.0, <= 3.6 | 3.x |
158
+
159
+
You can determine what version of Python you have installed by running:
0 commit comments