auth0-oauth-client 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tinuvi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.3
2
+ Name: auth0-oauth-client
3
+ Version: 0.2.0
4
+ Summary: A Django-focused Auth0 integration providing automated OIDC flows, account linking, and so on.
5
+ Home-page: https://github.com/tinuvi/auth0-oauth-client
6
+ License: MIT
7
+ Author: Tinuvi
8
+ Author-email: no-reply@tinuvi.com
9
+ Requires-Python: >=3.14,<4.0
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Dist: auth0-python (>=4.13.0,<5.0.0)
13
+ Requires-Dist: django (>=5.2.9,<6.0.0)
14
+ Requires-Dist: pyjwt (>=2.7.0,<3.0.0)
15
+ Requires-Dist: requests (>=2.32.5,<3.0.0)
16
+ Project-URL: Bug Tracker, https://github.com/tinuvi/auth0-oauth-client/issues
17
+ Project-URL: Repository, https://github.com/tinuvi/auth0-oauth-client
18
+ Description-Content-Type: text/markdown
19
+
20
+ # Auth0 OAuth Client
21
+
22
+ A Django-focused Auth0 integration providing automated OIDC flows, account linking, and connected account (My Account API). It's been created to support the [Auth0 Token Vault](https://auth0.com/docs/secure/call-apis-on-users-behalf/token-vault) feature, which requires Connected Accounts flow.
23
+
24
+ It's an opinionated library focused on the needs of our own products. Feel free to fork it and adapt it to your needs.
25
+
26
+ ## Rules
27
+
28
+ The [`sample_app`](./samples) demonstrates how to use the library. It implements the following rules:
29
+
30
+ - Only required scopes are requested for social connections.
31
+ - Additional scopes are requested during the [connected account request flow](https://auth0.com/docs/api/myaccount/create-connected-account-request) (progressive consent).
32
+ - When the user creates a connected account, that connected account is eligible for automatic account linking.
33
+ - Consider the following scenario:
34
+ - If a user logs in with `xpto@acme.com` and adds `qwerty@gmail.com` as a connected account, logging in later with the Gmail address will link both, with `xpto@acme.com` remaining the primary account. No confirmation is required.
35
+ - The same is true when the connected account matches the primary account.
36
+ - If a user signs up with an email/password, logs out, and later logs back in using a social connection with that same email, the accounts are automatically linked. The original email/password account is used as the primary account.
37
+ - If a user signs up via social, logs out, and later tries to log in with a password using the same email, they'll need to re-authenticate with the original social provider to link the accounts. The primary account is the social one.
38
+
39
+ ## Why did we build this?
40
+
41
+ Auth0 used to be the 'Stripe of Identity' sort of thing, known for its great developer experience. Lately, I’m not so sure. I almost gave up on it, but after finding some workarounds, I decided to build this library. I’m sharing it because seeing these issues go unaddressed hurts my software developer soul. 😬
42
+
43
+ Read the following Auth0 Community Questions for more details:
44
+
45
+ - [Auth0 Fails to Store Refresh Tokens for Linked Accounts](https://community.auth0.com/t/auth0-fails-to-store-refresh-tokens-for-linked-accounts/196953?u=tinuvi.solutions).
46
+ - [I had built an integration using Token Vault, and it stopped. Understand why](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/4?u=tinuvi.solutions).
47
+
48
+ At the time of writing this README (2026-02-13), [My Account API is not GA yet](https://auth0.com/docs/api/myaccount/). It means this library might eventually break if Auth0 changes its API, again. 😐
@@ -0,0 +1,29 @@
1
+ # Auth0 OAuth Client
2
+
3
+ A Django-focused Auth0 integration providing automated OIDC flows, account linking, and connected account (My Account API). It's been created to support the [Auth0 Token Vault](https://auth0.com/docs/secure/call-apis-on-users-behalf/token-vault) feature, which requires Connected Accounts flow.
4
+
5
+ It's an opinionated library focused on the needs of our own products. Feel free to fork it and adapt it to your needs.
6
+
7
+ ## Rules
8
+
9
+ The [`sample_app`](./samples) demonstrates how to use the library. It implements the following rules:
10
+
11
+ - Only required scopes are requested for social connections.
12
+ - Additional scopes are requested during the [connected account request flow](https://auth0.com/docs/api/myaccount/create-connected-account-request) (progressive consent).
13
+ - When the user creates a connected account, that connected account is eligible for automatic account linking.
14
+ - Consider the following scenario:
15
+ - If a user logs in with `xpto@acme.com` and adds `qwerty@gmail.com` as a connected account, logging in later with the Gmail address will link both, with `xpto@acme.com` remaining the primary account. No confirmation is required.
16
+ - The same is true when the connected account matches the primary account.
17
+ - If a user signs up with an email/password, logs out, and later logs back in using a social connection with that same email, the accounts are automatically linked. The original email/password account is used as the primary account.
18
+ - If a user signs up via social, logs out, and later tries to log in with a password using the same email, they'll need to re-authenticate with the original social provider to link the accounts. The primary account is the social one.
19
+
20
+ ## Why did we build this?
21
+
22
+ Auth0 used to be the 'Stripe of Identity' sort of thing, known for its great developer experience. Lately, I’m not so sure. I almost gave up on it, but after finding some workarounds, I decided to build this library. I’m sharing it because seeing these issues go unaddressed hurts my software developer soul. 😬
23
+
24
+ Read the following Auth0 Community Questions for more details:
25
+
26
+ - [Auth0 Fails to Store Refresh Tokens for Linked Accounts](https://community.auth0.com/t/auth0-fails-to-store-refresh-tokens-for-linked-accounts/196953?u=tinuvi.solutions).
27
+ - [I had built an integration using Token Vault, and it stopped. Understand why](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/4?u=tinuvi.solutions).
28
+
29
+ At the time of writing this README (2026-02-13), [My Account API is not GA yet](https://auth0.com/docs/api/myaccount/). It means this library might eventually break if Auth0 changes its API, again. 😐
@@ -0,0 +1 @@
1
+ from .client import auth_client
@@ -0,0 +1,56 @@
1
+ from django.contrib import admin
2
+
3
+ from auth0_oauth_client.models import AccountLinking
4
+ from auth0_oauth_client.models import AccountToken
5
+ from auth0_oauth_client.models import ConnectedAccount
6
+
7
+
8
+ @admin.register(ConnectedAccount)
9
+ class ConnectedAccountAdmin(admin.ModelAdmin):
10
+ list_display = (
11
+ "id",
12
+ "connected_account_id",
13
+ "email",
14
+ "provider",
15
+ "user_id_owner",
16
+ "is_account_linked",
17
+ "created_at",
18
+ "updated_at",
19
+ )
20
+ list_filter = (
21
+ "provider",
22
+ "is_account_linked",
23
+ )
24
+ search_fields = (
25
+ "email",
26
+ "user_id_owner",
27
+ )
28
+
29
+
30
+ @admin.register(AccountToken)
31
+ class AccountTokenAdmin(admin.ModelAdmin):
32
+ list_display = (
33
+ "id",
34
+ "user_id",
35
+ "refresh_token",
36
+ "created_at",
37
+ "updated_at",
38
+ )
39
+ search_fields = ("user_id",)
40
+
41
+
42
+ @admin.register(AccountLinking)
43
+ class AccountLinkingAdmin(admin.ModelAdmin):
44
+ list_display = (
45
+ "id",
46
+ "primary_user_id",
47
+ "secondary_provider",
48
+ "secondary_user_id",
49
+ "created_at",
50
+ "updated_at",
51
+ )
52
+ list_filter = ("secondary_provider",)
53
+ search_fields = (
54
+ "primary_user_id",
55
+ "secondary_user_id",
56
+ )
@@ -0,0 +1,6 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class Auth0OauthClientConfig(AppConfig):
5
+ default_auto_field = "django.db.models.BigAutoField"
6
+ name = "auth0_oauth_client"