Android Forums

Go Back   TalkAndroid Forums > Android Coders > Android Development, Answers, Tutorials, and Code Snippets
Connect with Facebook

Click Here To Register!
 
 
LinkBack Thread Tools Display Modes
Old 07-18-2009, 06:47 PM   #1
Junior Member
 
Join Date: Jul 2009
Posts: 6
Friends: 0
View Radzell's Profile   View Radzell's Photo Album   View Radzell's Blog   View Social Groups
I am using Oauth to make a android and app and it isn't going well i need code review.

Code:
private void authpost(String verificationCode) throws OAuthMessageSignerException, OAuthNotAuthorizedException, OAuthExpectationFailedException, OAuthCommunicationException, IOException{
    	/*Creates a consumer object and configure it with access
    	 * token and token secret still needed from service I HAVE NO IDEA
    	 * WHAT THEY ARE*/
    	 
    	OAuthConsumer consumer = new CommonsHttpOAuthConsumer(  
    	        CONSUMER_KEY, CONSUMER_SECRET, SignatureMethod.HMAC_SHA1);  
    	  Log.i("cliqdroid", "Finished consumer loading function");
    	  consumer.setTokenWithSecret(ACCESS_TOKEN, TOKEN_SECRET);
    	  
    	
    	//Http request to the protected resource
    	URL url = new URL("https://api.cliqset.com/200905/user/radzell/profile");
    	HttpURLConnection request = (HttpURLConnection) url.openConnection();
    	
    	//sign the request so it can get past the security
    	consumer.sign(request);
    	
    	//send the request to the server in order to obtain access to resource
    	request.connect();
    	
    	String responsecode = request.getResponseMessage();
    	
    	Log.i("Cliqdroid", responsecode);
    	
    	// create a new service provider object and configure it with
        // the URLs which provide request tokens, access tokens, and
        // the URL to which users are sent in order to grant permission
        // to your application to access protected resources
    	
    	OAuthProvider provider = new DefaultOAuthProvider(consumer,
                REQUEST_TOKEN_ENDPOINT_URL, ACCESS_TOKEN_ENDPOINT_URL,
                AUTHORIZE_WEBSITE_URL);
    	
    	 // fetches a request token from the service provider and builds
        // a url based on AUTHORIZE_WEBSITE_URL and CALLBACK_URL to
        // which your app must now send the user
        @SuppressWarnings("unused")
		String url1 = provider.retrieveRequestToken(OAuth.OUT_OF_BAND);
    	
        provider.retrieveAccessToken(verificationCode);
    	
    	
    }
Radzell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
 

Thread Tools
Display Modes




Unlocked G1 Phones | Buy T-Mobile G1 | Google Phone

All times are GMT -6. The time now is 03:23 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.
Copyright (c) 2012 TalkAndroid.com. All rights reserved.