Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: codespell
exclude: ^locale/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.10
rev: v0.15.12
hooks:
- id: ruff-check
args: [--fix]
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## `2.4.0` - 2026-05-06

#### πŸš€ New Features

- **Added optional `provider` argument to `get_metadata_by_email`**
- Enables explicitly targeting OAuth users by provider when an email user with the same email also exists
- Example: `get_metadata_by_email(email, provider="google")`

---

## `2.3.0` - 2026-04-14

#### πŸš€ New Features
Expand Down
11 changes: 5 additions & 6 deletions magic_admin/resources/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ class User(ResourceComponent):
v1_user_logout = "/v1/admin/user/logout"
v2_user_info = "/v2/admin/user"

def get_metadata_by_email(self, email):
return self.request(
"get",
self.v2_user_info,
params={"type": "email", "value": email},
)
def get_metadata_by_email(self, email, provider=None):
params = {"type": "email", "value": email}
if provider:
params["provider"] = provider
return self.request("get", self.v2_user_info, params=params)

def get_metadata_by_issuer_and_wallet(self, issuer, wallet_type):
return self.request(
Expand Down
2 changes: 1 addition & 1 deletion magic_admin/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "2.3.0"
VERSION = "2.4.0"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "magic-admin"
version = "2.3.0"
version = "2.4.0"
description = "Magic Python Library"
readme = "README.md"
authors = [
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/resources/user_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@ def test_get_metadata_by_email(self):
params={"type": "email", "value": sentinel.email},
)

def test_get_metadata_by_email_with_provider(self):
self.user.request = mock.Mock(return_value=self.metadata_no_wallets)

assert (
self.user.get_metadata_by_email(
sentinel.email,
provider="google",
)
== self.metadata_no_wallets
)

self.user.request.assert_called_once_with(
"get",
self.user.v2_user_info,
params={"type": "email", "value": sentinel.email, "provider": "google"},
)

@pytest.fixture
def mock_construct_issuer_with_public_address(self, mocker):
return mocker.patch(
Expand Down
Loading