Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8117389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:09:08+00:00 2026-06-06T04:09:08+00:00

I’m planning to integrate Yahoo in my Android Application to get the name and

  • 0

I’m planning to integrate Yahoo in my Android Application to get the name and personal details of a user. How do I integrate Yahoo with android?

I have spent several hours looking for a tutorial/sample android application that integrates Yahoo login using OAuth, but I can’t find one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:09:09+00:00Added an answer on June 6, 2026 at 4:09 am

    Look at the following code , You need Signpost library Signpost Library

    import oauth.signpost.OAuth;
    import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer;
    import oauth.signpost.commonshttp.CommonsHttpOAuthProvider;
    import oauth.signpost.exception.OAuthCommunicationException;
    import oauth.signpost.exception.OAuthExpectationFailedException;
    import oauth.signpost.exception.OAuthMessageSignerException;
    import oauth.signpost.exception.OAuthNotAuthorizedException;
    import oauth.signpost.signature.HmacSha1MessageSigner;
    import org.apache.http.HttpResponse;
    import org.apache.http.client.ClientProtocolException;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.entity.StringEntity;
    import org.apache.http.impl.client.DefaultHttpClient;
    import android.app.Activity;
    import android.app.AlertDialog;
    import android.app.Dialog;
    import android.content.DialogInterface;
    import android.content.Intent;
    import android.content.SharedPreferences;
    import android.net.Uri;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.widget.EditText;
    import android.widget.Toast;
    import com.synapse.selfervices.R;
    
    public class YahooScreen extends Activity {
        private static final String REQUEST_TOKEN_ENDPOINT_URL ="https://api.login.yahoo.com/oauth/v2/get_request_token";
        private static final String ACCESS_TOKEN_ENDPOINT_URL ="https://api.login.yahoo.com/oauth/v2/get_access_token";
        private static final String AUTHORIZE_WEBSITE_URL   ="https://api.login.yahoo.com/oauth/v2/request_auth";
        private static final int PIN_DIALOG = 0;
    String CALLBACK_URL = OAuth.OUT_OF_BAND; // this should be the same as the
    // SCHEME and HOST values in
    // your AndroidManifest.xml file
       String CONSUMER_KEY = "";//
       String CONSUMER_SECRET = "";
       private CommonsHttpOAuthConsumer myConsumer;
       private CommonsHttpOAuthProvider myProvider;
       private String requestToken;
       private String accessToken;
    
      /** Called when the activity is first created. */
     @Override
      public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            callOAuth();
            showDialog(PIN_DIALOG);
            // createPinDialog().show();
    }
    
    private void callOAuth() {
            try {
                    // retrieve the consumer token and then sign it
                    myConsumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY,
                                    CONSUMER_SECRET);
    
                    myConsumer.setMessageSigner(new HmacSha1MessageSigner());
    
                    HttpClient client = new DefaultHttpClient();
                    // retrieve the provider by using the signed consumer token
                    myProvider = new CommonsHttpOAuthProvider(
                                    REQUEST_TOKEN_ENDPOINT_URL, ACCESS_TOKEN_ENDPOINT_URL,
                                    AUTHORIZE_WEBSITE_URL, client);
                    myProvider.setOAuth10a(true);
                    String aUrl = myProvider.retrieveRequestToken(myConsumer,
                                    CALLBACK_URL);
    
                    requestToken = myConsumer.getToken();
                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(aUrl)));
            } catch (Exception ex) {
                    Toast.makeText(getApplicationContext(), ex.getMessage(),
                                    Toast.LENGTH_LONG).show();
                    Log.e(ex.getMessage(), ex.toString());
            }
    }
    
    // this is the callback function that will run when oauth authenticates
    // successfully
    @Override
    protected void onNewIntent(Intent intent) {
            System.out.println("OnNewIntent...");
            Toast.makeText(getApplicationContext(), "OnNewIntent - It works!",
                            Toast.LENGTH_LONG).show();
            // whatever you want to do after authenticating goes here ....
    }
    
    AlertDialog createPinDialog() {
            LayoutInflater factory = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    
            // LayoutInflater factory = LayoutInflater.from(this);
            final View textEntryView = factory.inflate(R.layout.pin, null);
            final EditText pinText = (EditText) textEntryView
                            .findViewById(R.id.pin_text);
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle("Twitter OAuth PIN");
            builder.setView(textEntryView);
            builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                            if (pinText != null)
                                    gotOAuthPin(pinText.getText().toString());
                            onResume();
                    }
            });
            return builder.create();
    }
    
    private void gotOAuthPin(String pin) {
            SharedPreferences.Editor editor = getSharedPreferences("yahoo",
                            MODE_PRIVATE).edit();
            try {
                    myProvider.retrieveAccessToken(myConsumer, pin);
                    accessToken = myConsumer.getToken();
    
            } catch (OAuthMessageSignerException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
            } catch (OAuthNotAuthorizedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
            } catch (OAuthExpectationFailedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
            } catch (OAuthCommunicationException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
            }
            if (accessToken != null && accessToken.length() > 0) {
                    Toast.makeText(this, "Authorized", Toast.LENGTH_SHORT).show();
                    HttpPost request = new HttpPost(
                                    "http://social.yahooapis.com/v1/user/profile?format=json");
                    StringEntity body = null;
                    /*
                     * try { body = new StringEntity("city=hamburg&label=" +
                     * URLEncoder.encode("Send via Signpost!", "UTF-8")); } catch
                     * (UnsupportedEncodingException e1) { // TODO Auto-generated catch
                     * block e1.printStackTrace(); }
                     * body.setContentType("application/x-www-form-urlencoded");
                     * request.setEntity(body);
                     */
    
                    try {
                            myConsumer.sign(request);
                    } catch (OAuthMessageSignerException e1) {
                            // TODO Auto-generated catch block
                            e1.printStackTrace();
        } catch (OAuthMessageSignerException e1) {
                            // TODO Auto-generated catch block
                            e1.printStackTrace();
                    } catch (OAuthExpectationFailedException e1) {
                            // TODO Auto-generated catch block
                            e1.printStackTrace();
                    } catch (OAuthCommunicationException e1) {
                            // TODO Auto-generated catch block
                            e1.printStackTrace();
                    }
    
                    System.out.println("Sending update request to Fire Eagle...");
    
                    HttpClient httpClient = new DefaultHttpClient();
                    HttpResponse response = null;
                    try {
                            response = httpClient.execute(request);
                    } catch (ClientProtocolException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                    } catch (IOException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                    }
    
                    Toast.makeText(
                                    this,
                                    "Response: " + response.getStatusLine().getStatusCode()
                                                    + " " + response.getStatusLine().getReasonPhrase(),
                                    Toast.LENGTH_SHORT).show();
            } else {
                    Toast.makeText(this, "Not Authorized", Toast.LENGTH_SHORT).show();
            }
    }
    
    @Override
    protected Dialog onCreateDialog(int id) {
            switch (id) {
            case PIN_DIALOG:
                    LayoutInflater factory = LayoutInflater.from(this);
                    final View textEntryView = factory.inflate(R.layout.pin, null);
                    final EditText pinText = (EditText) textEntryView
                                    .findViewById(R.id.pin_text);
                    AlertDialog.Builder builder = new AlertDialog.Builder(this);
                    builder.setTitle("OAuth PIN");
                    builder.setView(textEntryView);
                    builder.setPositiveButton("OK",
                                    new DialogInterface.OnClickListener() {
                                            public void onClick(DialogInterface dialog,
                                                            int whichButton) {
                                                    if (pinText != null)
                                                            gotOAuthPin(pinText.getText().toString());
                                            }
                                    });
                    return builder.create();
            }
    
            return super.onCreateDialog(id);
    }}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Thanks in advance for your help. I have a need within an application to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.