Format x-api-key header as keystring:sharedsecret
Etsy v3 expects both credentials joined by a colon in the x-api-key header; sending the shared secret alone returns 403 'incorrect shared secret for API key'. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
4333b1c55d
commit
e09f082420
1 changed files with 3 additions and 3 deletions
|
|
@ -44,11 +44,11 @@ const loadConfig = async (userId: string): Promise<EtsyConfig | null> => {
|
|||
return { apiKey, sharedSecret, redirectUri };
|
||||
};
|
||||
|
||||
// Keystring is the OAuth client id; Etsy wants the shared secret in the
|
||||
// x-api-key header for API resource calls
|
||||
// Keystring is the OAuth client id; API resource calls want the x-api-key
|
||||
// header formatted as "keystring:sharedsecret"
|
||||
const toCredentials = (config: EtsyConfig) => ({
|
||||
clientId: config.apiKey,
|
||||
apiKeyHeader: config.sharedSecret || config.apiKey,
|
||||
apiKeyHeader: config.sharedSecret ? `${config.apiKey}:${config.sharedSecret}` : config.apiKey,
|
||||
});
|
||||
|
||||
// Where to send the browser after the OAuth callback: same origin as the
|
||||
|
|
|
|||
Loading…
Reference in a new issue