com.smartfile.api
Class OAuthClient

java.lang.Object
  extended by com.smartfile.api.Client
      extended by com.smartfile.api.OAuthClient

public class OAuthClient
extends Client

Implements Smartfile API client using OAuth1 authentication. Provide credentials within constructor or environment variables.

Example of usage:
Scanner scan = new Scanner(System.in);
OAuthClient api = new OAuthClient("***********","*************");
api.get_request_token();
System.out.println(api.get_authorization_url());
api.get_access_token(scan.nextLine());

Now your client is ready.

See Also:
Client for details of API call.

Constructor Summary
OAuthClient()
          Creates OAuth client using credentials stored at environment variables SMARTFILE_CLIENT_TOKEN and SMARTFILE_CLIENT_SECRET
OAuthClient(java.lang.String client_token, java.lang.String client_secret)
          Creates OAuth client
 
Method Summary
 void get_access_token(java.lang.String verifier)
          Retrieves access token
 java.lang.String get_authorization_url()
          Returns an URL where Verifier must be obtained
 void get_request_token()
          Retrieves request token
 void get_request_token(java.lang.String callback)
          Retrieves request token to a specific callback
 
Methods inherited from class com.smartfile.api.Client
addHeader, delete, delete, delete, delete, get, get, get, get, getApiUrl, post, post, post, post, post, put, put, put, put, setApiUrl, setApiUrl
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OAuthClient

public OAuthClient()
Creates OAuth client using credentials stored at environment variables SMARTFILE_CLIENT_TOKEN and SMARTFILE_CLIENT_SECRET


OAuthClient

public OAuthClient(java.lang.String client_token,
                   java.lang.String client_secret)
            throws SmartFileException
Creates OAuth client

Parameters:
client_token - Client Token
client_secret - Client Secret
Throws:
SmartFileException
Method Detail

get_request_token

public void get_request_token()
                       throws SmartFileException
Retrieves request token

Throws:
SmartFileException

get_request_token

public void get_request_token(java.lang.String callback)
                       throws SmartFileException
Retrieves request token to a specific callback

Parameters:
callback - Callback url
Throws:
SmartFileException

get_authorization_url

public java.lang.String get_authorization_url()
                                       throws SmartFileException
Returns an URL where Verifier must be obtained

Returns:
URL where Verifier must be obtained
Throws:
SmartFileException

get_access_token

public void get_access_token(java.lang.String verifier)
                      throws SmartFileException
Retrieves access token

Parameters:
verifier - Verifier obtained at authorization page or to callback
Throws:
SmartFileException