Quick Overview
This workflow manages Etsy OAuth 2.0 (PKCE) authorization in n8n, stores access and refresh tokens in workflow static data, refreshes tokens when needed, and returns ready-to-use Etsy API request headers to other workflows via an Execute Workflow call.
How it works
- Runs either manually to start authorization, via a webhook callback from Etsy after consent, or when another workflow requests a token.
- Loads the Etsy app configuration (client ID, shared secret, redirect URI, scopes) and routes the run to start authorization, handle the callback, or return an access token.
- When starting authorization, generates a PKCE verifier/challenge and returns an Etsy authorization URL while storing the pending state for validation.
- When Etsy redirects to the callback webhook, validates the returned state and authorization code and then exchanges the code for tokens using the Etsy OAuth token endpoint.
- Stores the authorized access and refresh tokens (with expiry timestamps) in n8n workflow static data and returns a confirmation response to the callback request.
- When another workflow requests a token, loads the stored refresh token, refreshes the access token with Etsy if it is missing or near expiry, and returns Authorization and x-api-key headers for Etsy API calls.
Setup
- Create an Etsy developer app and register this workflow’s webhook URL (the OAuth callback path) as an allowed redirect URI in Etsy.
- Fill in the client ID, shared secret, redirect URI (production webhook URL), and required scopes in the Configuration step.
- Activate the workflow and run the manual start to generate the authorization URL, then complete consent in Etsy so the callback can store the initial tokens.
- In dependent workflows, use Execute Workflow to call this workflow with
action: get_token to receive the Etsy API headers.