Search code examples
javaoauth-2.0httprequestyahoo-api

How to create authorization URL request with paramters


im trying to work with yahoo Gemini api which need first to implement using Ouath 2.0

going into this link

Its saying i need to create a request to a URL with "Request Parameters"

client_id
redirect_uri

now lets say i do it in java:

this is my HTTP request:

HttpClient httpclient = HttpClients.createDefault();
HttpPost httppost = new 
HttpPost("https://api.login.yahoo.com/oauth2/request_auth");

is this how i added paramters to the request ?

List<NameValuePair> params = new ArrayList<NameValuePair>(2);
params.add(new BasicNameValuePair("client_id", "ABCDEFGH"));
params.add(new BasicNameValuePair("redirect_uri", "http://www.goTo.Com"));

is this is how i execute the entire request ?

httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
  1. is this the currect way to Get an authorization URL and authorize access ?
  2. is there any other way / simpler doing that ?
  3. what should i expect in the response ?

Solution

  • i believe that when you're working with Yahoo Gemini, you have to use a specific couple of consumer_key/consumer_secret according to my little investigation as stated in this issue

    You check the guide out for an implementation of oauth2 for yahoo apis. Hope it helped