-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to connect to Esty ? #466
Comments
Based on the information from Etsy's API documentation, the error you're encountering might be related to how the OAuth token is requested. Here are the key points to consider for the OAuth token request: POST Request Format: The access token should be requested using a POST request to https://api.etsy.com/v3/public/oauth/token. Request Body Parameters: The request body must include the following parameters in application/x-www-form-urlencoded format: grant_type: Must always be authorization_code. PKCE Verification: Make sure that the PKCE code_verifier and code_challenge are correctly generated and used. The code_verifier should be the preimage of the code_challenge used in the authorization request |
Thank you for your reply ! I tried to change my code, but without success.
I removed the parameter .setTokenUrl('https://api.etsy.com/v3/public/oauth/token') and I set the method to POST (although the default value is .setTokenMethod('POST')
I see a specific method for grant_type with : .setGrantType('authorization_code') but I don't understand how to set the others parameters. Could you provide an example ? |
It seems that the others parameters can be set with setTokenPayloadHandler(tokenHandler) And a tokenHandler already has some parameters I need :
So, I need to set an additional parameter code_verifier, and remove the client_secret : function getService_() {
...
.setTokenPayloadHandler(etsyTokenHandler);
}
function etsyTokenHandler(payload) {
payload.code_verifier = PropertiesService.getUserProperties().getProperty('code_verifier');
if (payload.client_secret) {
delete payload.client_secret;
}
return payload;
} Unfortunately, I am stuck with the same error : |
try something like this
|
Thanks for your help, I have exactly the same code as you, excepted this extra line : .setGrantType('authorization_code') But I tried, with and without this line, and I get the same error. I just saw in Etsy documentation, that I need to register a callback URL :
I tried to set |
Have you gone through this documentions ? |
@Niji-Bemani I'd be willing to help you but it is such a hustle to get approved for an app on this platform! |
Hi ! I am trying to use your library to connect to the new Etsy API (v3) that require OAuth2.
I used the Twitter sample, and tried to adapt it for Etsy.
I can generate the authorization url and see the Etsy page to grant access.
However, the redirection fails with this error :
Error: Error retrieving token: Invalid authorization header (line 605, file "Service", project "OAuth2")
, and I have no idea what part should be changed to make it work.Here is my code :
The text was updated successfully, but these errors were encountered: