Setting Up the Etsy OAuth2 Client For Use With The Etsy Shop Integration Module
May 10, 2024Drupal Odyssey is supported by it's readers. When you purchase products or services using the links on this site, we may earn a small commission at no additional cost to you. Learn more
The Etsy Shop Integration Drupal module requires an application ID from Etsy to make calls to the Etsy v3 API. Before being able to obtain the application ID, you must first authenticate your new application with Etsy using OAuth 2 which consists of a unique key string and secret. This blog post will walk you through creating up your app in the Etsy Developer developer portal and setting up the OAuth 2 client in Drupal.
Create Your Etsy App
To use the Etsy Shop Integration module, you will first need to register for an Etsy application by going to https://www.etsy.com/developers/register. (Before being able to create an Etsy application, you will first need to enable two factor authentication for Etsy.) From there, you will be presented with a form that tells Etsy about your application such as the application name, a description of your application, and the website URL for your Drupal website and other information about your application.
Once you have completed the form, click the button labeled "Read Terms and Create App". This opens a popup with the Etsy API of Use that you must agree to before your app is created. Once your application is created, you will be able to access your unique key string and secret which you will need to be able to set up the Etsy OAuth2 Client.
Detailed information on how the Etsy OAuth2 authentication works is located in the official Etsy Open API v3 documentation.
Configuring the Etsy OAuth2 Client
Logged in to your Drupal site, using the administration menu, go to Configuration → System → OAuth2 Clients. There you will see an OAuth Client configuration labeled 'Etsy'. Under the 'Operations' column, click the drop-down arrow and select Edit. Scroll down to the "Client Settings: Etsy" section and enter the information from your Etsy application into the fields; the keystring is the value for the Client ID field and the shared secret is the value for the Client secret field.
When this information has been filled in, click the button labeled "Save and request token". This opens the Etsy authorization. Verify the information and authorize the Drupal application. This should redirect you back to the OAuth Client listing on your Drupal site.
Updating the OAuth 2 Token
When you initially save your Etsy OAuth2 Client and request an application token, the token is stored for future requests. This token is valid for one hour since the last API call. To prevent needing to reauthorize the application, the Etsy Shop Integration module has a cron task that pings the Etsy API to keep the issued token alive.
If, for some reason, you are experiencing issues connecting to the Etsy API, you may need to manually refresh your API token. To do this, return to the Etsy OAuth 2 Client configuration form and click the button labeled "Save and request token" again.
Conclusion
There you have it! By following these steps, you should have your Etsy application and OAuth2 Client set up for use with the Etsy Shop Integration module! If you have problems getting things configured correctly, post a comment and I'll help sort where things are going wrong to get you going.
0 Comments
Login or Register to post comments.