-
Hello all, First-time Etsy API coder and Python user here... so go easy on me! 😊 I’m encountering an issue where Etsy returns an error stating that my code_verifier is invalid when attempting to exchange an authorization code for an access token. Context: I’ve manually tested and confirmed that the code_verifier and code_challenge values are consistent from generation through to their use in the OAuth flow. Despite these checks, the Etsy server still returns the following error when attempting the access token exchange: This suggests that the Etsy server method of validating the code_verifier against the code_challenge is somehow not aligning with my own python implementation. Questions: Are there any specific requirements or edge cases in Etsy's PKCE implementation (e.g., length restrictions, character encoding nuances) that I might be overlooking? Below are the Python functions I’m using. Additional Information:
I’ve verified that the code_verifier being sent matches what was used to generate the code_challenge. ######################################################### def generate_code_verifier():
######################################################### def generate_code_challenge(code_verifier):
######################################################### def verify_code_challenge(code_verifier, code_challenge):
######################################################### |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It seems I have solved my own problem... When initiating a fresh oauth flow Etsy pops up a browser tab asking the user to grant access before it issues the auth code data. So I have now added a small tkinter popup window with an "OK to proceed..." button where the ptython code waits up to x-seconds (I can vary this wat time as required) until the user clicks grant access and then the proceed buttons before moving on with fetching the auth code. Now I am getting an access token returned without error every time. Happy days!!! I can now move on. |
Beta Was this translation helpful? Give feedback.
It seems I have solved my own problem...
When initiating a fresh oauth flow Etsy pops up a browser tab asking the user to grant access before it issues the auth code data.
My API app was not waiting for the user to click this grant access button but requested the auth code before the button had been clicked.
This meant that some kinda old/random code data was extracted from browser cached data which mean following python code was using an old possibly expired auth code. This was causing the random errors I was experiencing. Mostly code verifier invalid.
So I have now added a small tkinter popup window with an "OK to proceed..." button where the ptython code waits up to x-seconds (I can va…