How to manually generate a Shopify Token?
A token-based authentication system allows users to enter their username and password in order to obtain a token, which allows them to fetch a specific resource, without using their username and password. Once their token has been obtained, the user can offer the token, which offers access to a specific resource for a time period, to the remote site.
This article explains how to generate a Shopify Service token, step by step, with the needed permissions for the COZYROC REST Connection Manager component.
In order to use the generated token, you need to create a specific XML file, which then needs to be entered into the REST Connection Manager Configuration. To simplify this article, the process has been separated into 4 steps:
1) Generate authorization code and give permission to COZYROC to access your Shopify Service
2) Create a custom POST request to be sent to the Shopify server
3) Receive the authorization token in JSON format so that you can examine the result from the response
4) Create an XML file for the token that complies to the COZYROC token XML format
Step 1: Generate authorization code and give permission to COZYROC to access your Shopify Service
We have prepared a URL for Shopify Service, that is going to be used to grant COZYROC permissions to access your Shopify Service. Please use the URL below:
You need to replace [shop] with your Shopify's sub-domain. For example "cozyroc-paradise" is our domain and we are going to use the following URL:
For explanation which parameters you need and the value you need for each parameter please look at the table below. The table below shows the parameters and their value for Shopify token. You will find those parameters and values in the URL above.
- Click the URL above and then the following screen will open:
- Then enter your credentials and grant permissions to COZYROC to access your Shopify Service
- As a result, a link will be generated, that includes the authorization code that we are going to need in Step 2.
In our case the following link gets generated:
You are going to need the value of the code parameter from the generated URL and, in our case, this value is:
code = 661b34ff9b1e1fe9fb98a16005ba149f
You can use this code for only a single request and it will expire in 5 minutes or less.
Step 2: Create a custom POST request to be sent to the Shopify server
In this step, we are going to create a POST URL that needs to be sent to the Shopify Server. In order to do that, we will be using POSTMAN. You can use any software that will allow you to do that.
In the following table, you can find all the Post request parameters that you are going to need and their values.
| Parameter|| Value||Notes|
| client_id||d78667e82b03c023965f9235cab24466||You should use this value|
|client_secret||5c491dda45ed6293ccba5b810565084c||You should use this value|
|In my case, the Code value will be: 661b34ff9b1e1fe9fb98a16005ba149f. It will be a different value for you. Please look at the information above.|
To create a new POST Request by POSTMAN please follow the steps:
- Login to POSTMAN
- Click the button "New" and select "Request" from the dropdown menu.
- Enter request name and save your request.
- Open your request, select POST for the Request and enter for URL: "https://[shop].myshopify.com/admin/oauth/access_token". This is the URL where we are going to send the Post Request.
Do not forget to replace [shop] with your Shopify's sub-domain in the URL!
- Click "Body"
- Select "x-www-form-urlencoded
- Enter for Key and Value all the Post request parameters and their values we showed you in the table above. Please look at the screenshot below:
- Then click "Send" to send the POST Request
Once you send the Post request you will get a response in JSON format.
Step 3: You will receive the authorization token in JSON format. You will need to examine the result from the response.
If the operation is successful, you will get a response similar to the following in JSON Format:
If you don't get the response, examine your process for errors and fix them.
We will use the access_token value in the next step to create the XML Token File.
Step 4: Create an XML file for the token that complies with the COZYROC token XML format
- Go to your REST Connection Manager and click on it twice; the REST Connection Manager configuration screen will open.
- Select "Shopify" for Configuration. Please look at the screenshot below:
- Click the button "New" to create a new token file.
- Complete all the steps until you get to the third page of the Wizard. Please look at the screenshot below:
- For "Access Token", enter the access_token value from the JSON Response you received above.
- For "Expiration(UTC):", keep the default expiration date and time value that was automatically calculated(Current UTC date and time + 50 minutes )
- For "Save Files:", enter the file token name and the file path where you want to save the newly generated Token XML File.
- For "Password:", enter a token password. Please look at the screenshot below:
- Click the "OK" button. Your token XML file will be generated. Please look at the screenshot below:
- Click the "Test Connection" button and you should get the message "Test connection succeeded".
How to manually generate a Google Services Token?
A token-based authentication system allows users to enter their username and password in order to obtain a token, which allows them to fetch a specific resource, without using their username and password. Once their token has been obtained, the user ...
Where can I find the documentation for the Shopify Connection?
You can find documentation related to all the COZYROC SSIS+ Component Suite components from the main products page. Specific documentation for the Shopify Connection can be found at the following link. For many of the components you can find ...
Considerations when choosing REST token storage
Since version 2.1 in COZYROC SSIS+ access tokens used by REST Connection Manager can be stored not only in the file system, but also in a database (SQL Server). Using such a centralized storage addresses the following complications with the ...
How to use a Database storage for new REST tokens
Make sure you have launched Visual Studio as "Run as Administrator". 1 : In Rest Connection Manager choose the configuration from the dropdown list you want to generate token for. 2: For the Token storage parameter in the grid below select Database ...
Why does my token keep expiring in a few days?
Issue: Most likely the reason for the token expiration is that the default expiration date of the token has been manually changed in the screen below: Solution: While creating a token the default expiration date should be kept and not changed. The ...