Skip to content

Commit 469c292

Browse files
committed
fix: use Authorization header for Verify Engine API
The Verify Engine API requires the token in the Authorization header, not in the form data. This was causing "Authentication credentials were not provided" errors when using searchAsset/search_asset. Changes: - TypeScript: Send token via Authorization header in searchAsset - Python: Send token via Authorization header in search_asset - Bump version to 0.2.1 Fixes the verify engine authentication issue discovered during integration testing of v0.2.0.
1 parent 1d84dbb commit 469c292

File tree

7 files changed

+15
-7
lines changed

7 files changed

+15
-7
lines changed

integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"test:py": "python test_published_sdk.py"
99
},
1010
"dependencies": {
11-
"@numbersprotocol/capture-sdk": "0.2.0",
11+
"@numbersprotocol/capture-sdk": "^0.2.1",
1212
"sharp": "^0.33.0"
1313
},
1414
"devDependencies": {

integration-tests/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Python dependencies for integration tests
2-
numbersprotocol-capture-sdk==0.2.0
2+
numbersprotocol-capture-sdk>=0.2.1
33
Pillow>=10.0.0

python/numbersprotocol_capture/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
UpdateOptions,
4141
)
4242

43-
__version__ = "0.2.0"
43+
__version__ = "0.2.1"
4444

4545
__all__ = [
4646
# Main client

python/numbersprotocol_capture/client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ def search_asset(
654654
):
655655
raise ValidationError("sample_count must be a positive integer")
656656

657-
form_data: dict[str, Any] = {"token": self._token}
657+
form_data: dict[str, Any] = {}
658658

659659
# Add input source
660660
files_data: dict[str, Any] | None = None
@@ -672,16 +672,21 @@ def search_asset(
672672
if options.sample_count is not None:
673673
form_data["sample_count"] = str(options.sample_count)
674674

675+
# Verify Engine API requires token in Authorization header, not form data
676+
headers = {"Authorization": f"token {self._token}"}
677+
675678
try:
676679
if files_data:
677680
response = self._client.post(
678681
ASSET_SEARCH_API_URL,
682+
headers=headers,
679683
data=form_data,
680684
files=files_data,
681685
)
682686
else:
683687
response = self._client.post(
684688
ASSET_SEARCH_API_URL,
689+
headers=headers,
685690
data=form_data,
686691
)
687692
except httpx.RequestError as e:

python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "numbersprotocol-capture-sdk"
7-
version = "0.2.0"
7+
version = "0.2.1"
88
description = "Python SDK for Numbers Protocol Capture API"
99
readme = "README.md"
1010
license = "MIT"

ts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@numbersprotocol/capture-sdk",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "TypeScript SDK for Numbers Protocol Capture API",
55
"type": "module",
66
"main": "./dist/index.cjs",

ts/src/client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ export class Capture {
494494
}
495495

496496
const formData = new FormData()
497-
formData.append('token', this.token)
498497

499498
// Add input source
500499
if (options.fileUrl) {
@@ -517,8 +516,12 @@ export class Capture {
517516
formData.append('sample_count', String(options.sampleCount))
518517
}
519518

519+
// Verify Engine API requires token in Authorization header, not form data
520520
const response = await fetch(ASSET_SEARCH_API_URL, {
521521
method: 'POST',
522+
headers: {
523+
Authorization: `token ${this.token}`,
524+
},
522525
body: formData,
523526
})
524527

0 commit comments

Comments
 (0)