As of Convertigo 7.1, HTTP connector supports now OAuth authentications. This is useful to connect to OAuth protected resources such as Twitter, Linkedin or Google+.
You can have more information about OAuth on the official OAuth web site: http://oauth.net
Registering your app for OAuth
Most of the OAuth enabled service will ask you to register your app to their framework. We will use Twitter services in this sample.
Create a new app, for example ‘Convertigo’. Fill in App name, App description (10 Chars min), a web site URL. Filling in the call back URL is not mandatory.
Click on the “API Key” Tab
Save your “API key” and “API secret” in a safe place. You will use this information later on
Modify the application permissions if required by click on the “Change App Permissions” button
Click on the “Create my access tokens” button. This will create access token for your own current credentials. This means that all the actions you will do with the Convertigo HTTP connector will be done with the current identity.
Refresh the page, a new section with your access tokens should appear. Save the “Access token” and the “Access token secret” in a safe place as you will use this later on.
Now, we should have the following values:
API Key
API Secret
Access token
Access token secret
Accessing an OAuth service.
This is all we need to use the Convertigo’s HTTP Connector OAuth. To see how, we will use Twitter’s get timeline REST API.
Create a new Project
Create a HTTP Connector, set the “server” property to “api.twitter.com” and the “Root Path” property to “/1.1/”. Set “is HTTPS” to “true” and “port” to 443. This will create and configure a connector connecting to https://api.twitter.com/1.1/
In this connector, create a “JSON Http Transaction”. Configure the “HTTP verb” to “GET” and the “Sub Path” to “statuses/user_timeline.json”.
According to twitter documentation we must also provide “screen_name” and a “count” as parameters. We can do that by adding them as variables to our transaction. Be sure to configure the “HTTP Name” property of the variables objects to “screen_name” and “count”.
Set default values to screen_name and count according to your Twitter account. Run the transaction and you have an error response.
This is where the OAuth part comes in! Enabling OAuth is simply done by providing 4 other variables to our Transaction:
__header_oAuthKey
__header_oAuthSecret
__header_oAuthToken
__header_oAuthTokenSecret
Configure the “Default Value” properties of each of those variables with the values we got from the registering part. Now, execute the transaction :
Launch test platform Right Click -> Open test platform
Expand the HTTP Connector
Expand the JSON_HTTP Transaction
Check that default values are filled in the test form
Of course in this simple project we used default values for the OAuth keys, but you could (And this recommended) use global symbols instead.
Using Twitter for sample, you can see how you can access the other services such a LinkedIN, Google+ or any other OAuth enabled service available on the web.