Test the app authorizations you create, before making them live for your users. Besides, testing authorizations you can also test Endpoints and Actions. Testing an activity and an endpoint will only work if the user account is properly connected. So, it is recommended to test your authorization first and then move to test other modules.
When you create an app connector for your app (or any third-party app) in Integry, you need to authorize Integry to access the API on your behalf.
When creating these authorizations, you can test them under the Authorization tab in your App's menu. Learn more about authorizations and how to use them. We support all popular authorization types.
Let's say you've created an app connector for your app using the API Key authorization method. Now you need to check whether your application has an API that returns the identity of the user (of that specific account or any account added for this app by different users).
Let's test our authorization.
Step 1: Select 'No' if the app you are integrating does not have an API that returns the details, like name, email address, etc., of the user whose API key you are using.
In our case, GitHub does have an API that returns user identity data, so we'll select 'Yes.'
Selecting yes or no at this stage doesn't make much difference. The only difference is that when you choose Yes, Integry will treat the response of the API as the user's identity.
In case if you select No here, you will still be asked to configure an API call in the following steps to verify that the token you provided. In this case, however, the response is not differentiable. Therefore the response of the API call will not be used as the user identifier.
Click on 'Continue' to move on to the next step.
API For User Information
Step 2: In this step, we'll configure the user identity call (for which we selected 'yes' in the previous step).
First of all, we'll configure the base URL of our application or API in the 'Request URL' field.
Note: Base URL is the initial part or prefix of all the URLs in your application or a large subset of the URLs in your API.
We'll select the GET request for the API call.
In this case, the base URL is api.github.com.
Type in your base URL and hit enter to save the URL.
You'll see that the final URL will be saved and appear right below the 'Request URL' field.
Next, you have to write the unique part of this API that needs to be tagged onto the API call.
In this scenario, we need to write '/user' for getting the information of the currently logged-in user. That is how you can configure the URL of your API. (Please refer to the image below)
Step 3: In this step, you need to add the header here for your API call.
This header is added here automatically using the header information. However, you can manually add the header information here by clicking on the '+ Add Header' button (as shown in the above image).
Go through your app's API documentation to learn what information to fill here.
Step 4: Once you've filled in the Request URL and header information, click on the 'Test Authorization' button.
By doing this, your API call details will be saved into Integry's database, and a dialog box will launch where you need to enter your API key.
Note: If the pop-ups are blocked in your browser, you need to allow them access so that this pop-up dialog box appears at this stage. Add your API key here.
Click on 'Proceed.'
When the API key is successfully filled, the API call will be executed. The response of the API key will be populated in a read-only code editor (as shown in the image below).
The read-only code editor denotes that you can't modify this code. Instead, you can view what your API call returned. Additionally, you can see the headers that were returned from the API.
The status of the Test Result will determine whether the execution was successful or not. For example, if the status code is 200, that means that the test ran successfully. The latency field shows the total time of execution for the API call.
Furthermore, you can also see the auto-generated name of the account you added. It displays the last four characters of your API key and hides the rest of the characters by replacing them with asterisks.
Step 5: Towards the end, you can see the notification, 'Your test was successful! Let's proceed' followed by a 'Continue' button that you can click to move on to the next step.
Step 6: In this step, we will pick some values from the response from the previous step and populate them in our code area.
Here, we need to create a JSON object. This object needs to have a key name user identity, and its value needs to be generated from the API response we received in the previous step.
We have all the responses available here for this response object (as highlighted in the image below). In addition, we have Twig
templating language available for accessing the values from inside that response object.
The benefit of using the Twig tags instead of hardcoding the values is that when other people start using this particular application (GitHub app in our case) and enter their own API key, the API call will be made on their behalf.
And the corresponding fields from the response will be picked - whatever values are returned for them at that time.
Note: These are just some example values. We might not have these values in our specific response that will be returned from our API, but we do have all tags available in the menu from the response object. Access the tag menu by clicking on the (+) sign. (Shown in the image below)
The tag menu has all the tags that were in the response object in the previous section. (Refer to the heading Authorization Testing and step 5)
Step 7: You can add as many tags as you want and select a format of your choice to compose the label/identification for the user on whose behalf you are executing different APIs of your app.
If you want to have a look at the final structure of the JSON, you can click on the 'Run' button (as shown in the image below). This action (execution) will render the Twig on the runtime and bring the final results.
In this example, it is specifically using the response of the API call that we made using our own token/API key. So, it will show their username and their ID when they connect their accounts for every user.
Upon successful execution, a notification will appear 'All done here! Let's proceed.' Click on 'Continue' to move on to the next section.
Congratulations! you have successfully created an app connector for your application.
You can move on to the next step and choose the activities you want to perform with this integration.