diff --git a/.changeset/ninety-heads-work.md b/.changeset/ninety-heads-work.md new file mode 100644 index 00000000000..3be2d8423c0 --- /dev/null +++ b/.changeset/ninety-heads-work.md @@ -0,0 +1,5 @@ +--- +"@thirdweb-dev/service-utils": patch +--- + +update error response url diff --git a/packages/service-utils/src/core/authorize/client.test.ts b/packages/service-utils/src/core/authorize/client.test.ts index 645103327c5..e9f98986613 100644 --- a/packages/service-utils/src/core/authorize/client.test.ts +++ b/packages/service-utils/src/core/authorize/client.test.ts @@ -80,7 +80,7 @@ describe("authorizeClient", () => { ) as any; expect(result.authorized).toBe(false); expect(result.errorMessage).toBe( - "Invalid request: Unauthorized Bundle ID: com.foo.bar. You can view the restrictions on this API key at https://thirdweb.com/create-api-key", + "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", ); expect(result.errorCode).toBe("BUNDLE_UNAUTHORIZED"); expect(result.status).toBe(401); @@ -101,7 +101,7 @@ describe("authorizeClient", () => { ) as any; expect(result.authorized).toBe(false); expect(result.errorMessage).toBe( - "Invalid request: Unauthorized domain: unauthorized.com. You can view the restrictions on this API key at https://thirdweb.com/create-api-key", + "Invalid request: Unauthorized domain: unauthorized.com. You can view the restrictions for this project at https://thirdweb.com/test-team/test-project/settings", ); expect(result.errorCode).toBe("ORIGIN_UNAUTHORIZED"); expect(result.status).toBe(401); diff --git a/packages/service-utils/src/core/authorize/client.ts b/packages/service-utils/src/core/authorize/client.ts index 5594e47de01..770948e9536 100644 --- a/packages/service-utils/src/core/authorize/client.ts +++ b/packages/service-utils/src/core/authorize/client.ts @@ -62,7 +62,7 @@ export function authorizeClient( return { authorized: false, errorCode: "ORIGIN_UNAUTHORIZED", - errorMessage: `Invalid request: Unauthorized domain: ${origin}. You can view the restrictions on this API key at https://thirdweb.com/create-api-key`, + errorMessage: `Invalid request: Unauthorized domain: ${origin}. You can view the restrictions for this project at https://thirdweb.com/${team.slug}/${project.slug}/settings`, status: 401, }; } @@ -81,7 +81,7 @@ export function authorizeClient( return { authorized: false, errorCode: "BUNDLE_UNAUTHORIZED", - errorMessage: `Invalid request: Unauthorized Bundle ID: ${bundleId}. You can view the restrictions on this API key at https://thirdweb.com/create-api-key`, + errorMessage: `Invalid request: Unauthorized Bundle ID: ${bundleId}. You can view the restrictions for this project at https://thirdweb.com/${team.slug}/${project.slug}/settings`, status: 401, }; } diff --git a/packages/service-utils/src/core/authorize/service.ts b/packages/service-utils/src/core/authorize/service.ts index f95fe83da55..94a9036f5dc 100644 --- a/packages/service-utils/src/core/authorize/service.ts +++ b/packages/service-utils/src/core/authorize/service.ts @@ -43,7 +43,7 @@ export function authorizeService( return { authorized: false, errorCode: "SERVICE_UNAUTHORIZED", - 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`, + 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`, status: 403, }; } @@ -57,7 +57,7 @@ export function authorizeService( return { authorized: false, errorCode: "SERVICE_ACTION_UNAUTHORIZED", - 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`, + 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`, status: 403, }; }