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.

  1. Connect to https://apps.twitter.com
  2. Sign in with your twitter account.
  3. 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.
  4. Click on the “API Key” Tab
  5. Save your “API key” and “API secret” in a safe place. You will use this information later on
  6. Modify the application permissions if required by click on the “Change App Permissions” button
  7. 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.
  8. 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.

    1. Create a new Project
    2. 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/

    1. In this connector, create a “JSON Http Transaction”. Configure the “HTTP verb” to “GET” and the “Sub Path” to “statuses/user_timeline.json”.

    1. 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”.
    2. 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 :

    1. Launch test platform Right Click -> Open test platform

  1. Expand the HTTP Connector
  2. Expand the JSON_HTTP Transaction
  3. Check that default values are filled in the test form
  4. Click on the Execute button for this Transaction. 

 oauth_testplatform

Convertigo will connect using the OAuth authentication mechanism, issue a GET https://api.twitter.com/1.1/statuses/user_timeline.json and retrieve your current Twitter timeline.

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.


Leave a comment