• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Oauth on android problem

Radzell

Lurker
Jul 5, 2009
7
0
I need code review i keep getting a error in the emulator


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);
    	
    	
    }
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones