Skip to content

Commit 34d2fdd

Browse files
committed
Update error response URL for project settings (#7613)
# Update error response URL in service-utils This PR updates the error response URLs in the service-utils package to point to the project-specific settings page instead of the generic API key creation page. The new URLs follow the format `https://thirdweb.com/${team.slug}/${project.slug}/settings`, providing users with a direct link to manage restrictions for their specific project. The changes affect error messages for: - Unauthorized domains - Unauthorized bundle IDs - Unauthorized services - Unauthorized service actions <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Updated error messages for unauthorized access to provide project-specific URLs, directing users to the relevant project settings page for more accurate guidance. * **Chores** * Added documentation to track the patch update related to error response URLs. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent a7544f7 commit 34d2fdd

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

.changeset/ninety-heads-work.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/service-utils": patch
3+
---
4+
5+
update error response url

packages/service-utils/src/core/authorize/client.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe("authorizeClient", () => {
8080
) as any;
8181
expect(result.authorized).toBe(false);
8282
expect(result.errorMessage).toBe(
83-
"Invalid request: Unauthorized Bundle ID: com.foo.bar. You can view the restrictions on this API key at https://thirdweb.com/create-api-key",
83+
"Invalid request: Unauthorized Bundle ID: com.foo.bar. You can view the restrictions for this project at https://thirdweb.com/test-team/test-project/settings",
8484
);
8585
expect(result.errorCode).toBe("BUNDLE_UNAUTHORIZED");
8686
expect(result.status).toBe(401);
@@ -101,7 +101,7 @@ describe("authorizeClient", () => {
101101
) as any;
102102
expect(result.authorized).toBe(false);
103103
expect(result.errorMessage).toBe(
104-
"Invalid request: Unauthorized domain: unauthorized.com. You can view the restrictions on this API key at https://thirdweb.com/create-api-key",
104+
"Invalid request: Unauthorized domain: unauthorized.com. You can view the restrictions for this project at https://thirdweb.com/test-team/test-project/settings",
105105
);
106106
expect(result.errorCode).toBe("ORIGIN_UNAUTHORIZED");
107107
expect(result.status).toBe(401);

packages/service-utils/src/core/authorize/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function authorizeClient(
6262
return {
6363
authorized: false,
6464
errorCode: "ORIGIN_UNAUTHORIZED",
65-
errorMessage: `Invalid request: Unauthorized domain: ${origin}. You can view the restrictions on this API key at https://thirdweb.com/create-api-key`,
65+
errorMessage: `Invalid request: Unauthorized domain: ${origin}. You can view the restrictions for this project at https://thirdweb.com/${team.slug}/${project.slug}/settings`,
6666
status: 401,
6767
};
6868
}
@@ -81,7 +81,7 @@ export function authorizeClient(
8181
return {
8282
authorized: false,
8383
errorCode: "BUNDLE_UNAUTHORIZED",
84-
errorMessage: `Invalid request: Unauthorized Bundle ID: ${bundleId}. You can view the restrictions on this API key at https://thirdweb.com/create-api-key`,
84+
errorMessage: `Invalid request: Unauthorized Bundle ID: ${bundleId}. You can view the restrictions for this project at https://thirdweb.com/${team.slug}/${project.slug}/settings`,
8585
status: 401,
8686
};
8787
}

packages/service-utils/src/core/authorize/service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function authorizeService(
4343
return {
4444
authorized: false,
4545
errorCode: "SERVICE_UNAUTHORIZED",
46-
errorMessage: `Invalid request: Unauthorized service: ${serviceConfig.serviceScope} for project: ${project.name} (${project.publishableKey}). You can view the restrictions on this project in your dashboard: https://thirdweb.com`,
46+
errorMessage: `Invalid request: Unauthorized service: ${serviceConfig.serviceScope} for project: ${project.name} (${project.publishableKey}). You can view the restrictions for this project at https://thirdweb.com/${team.slug}/${project.slug}/settings`,
4747
status: 403,
4848
};
4949
}
@@ -57,7 +57,7 @@ export function authorizeService(
5757
return {
5858
authorized: false,
5959
errorCode: "SERVICE_ACTION_UNAUTHORIZED",
60-
errorMessage: `Invalid request: Unauthorized action: ${serviceConfig.serviceScope} ${serviceConfig.serviceAction} for project: ${project.name} (${project.publishableKey}). You can view the restrictions on this API key in your dashboard: https://thirdweb.com/create-api-key`,
60+
errorMessage: `Invalid request: Unauthorized action: ${serviceConfig.serviceScope} ${serviceConfig.serviceAction} for project: ${project.name} (${project.publishableKey}). You can view the restrictions for this project at https://thirdweb.com/${team.slug}/${project.slug}/settings`,
6161
status: 403,
6262
};
6363
}

0 commit comments

Comments
 (0)