Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

The Flow

The process goes as follows:

  1. The website will provide the user with an authorization link; the link will look like this: https://api.twitter.com/oauth/authorize?oauth_token=some_oauth_token
    Obtaining the authorization url is done via an api call to the request token resource on twitter 
  2. The user clicks on the link, gets a dialog and either
    1. clicks on authorize (the case we're interested in)
    2. or clicks on decline
  3. The twitter dialog will redirect to the specified redirect_uri, including the request token, request token secret and the oauth verifier
  4. The application at the redirect_uri will
    1. read the oauth token parameter and identify the user (oauth token parameter is the request token returned from the get authorization url request)
    2. obtain an access token, based on the provided code

Anchor
Generating the authorization url
Generating the authorization url
Generating the authorization url

Generating the authorization url is done using the apstrata scripting method:

apsdb.social.twitter.getRequestToken

 

apsdb.social.twitter.getRequestToken(AppId, AppSecret, redirect_uri)
ex:
apsdb.social.facebook.getRequestToken("444444444444444", "626262626262662626262", "http://www.domain.com/twitterAuthCallbackPage.php") 

the result of this call is going look like:

"result": {
"authorizationUrl": "https://api.twitter.com/oauth/authorize?oauth_token=5cPG4",
"requestToken": "5cPG4",
"requestSecret": "0hZLMbCW5dbcVq7SMigsxhDW6fk"
}

where authorizationUrl is the url the user needs to directed to, which will show him the "allow" button.

the request token and request secret will be user to identify the user when your application will get the redirect call.

 
Anchor
Obtaining the AccessToken/Secret Pair
Obtaining the AccessToken/Secret Pair
Obtaining the AccessToken/AccessTokenSecret Pair

Obtaining the AccessToken is done using the apstrata scripting method

apsdb.social.twitter.getAccessToken

 

apsdb.social.facebook.getAccessToken(ConsumerKey, ConsumerSecret, RequestToken, RequestTokenSecret, verifier)
ex:
apsdb.social.twitter.getAccessToken("444444444444444","626262626262662626262", "5cPG4", "0hZLMbCW5dbcVq7SMigsxhDW6fk", "YzQX8rPRaBQXegIGUR9I00lzah");

the response of this code will include a pair of AccessToken and AccessTokenSecret which will be used for all twitter access calls.