1

Error message using yql: The table social.profile requires a higher security level than is provided, you provided ANY but at least APP is expected

Hi,

When I want to make the first request for private user data:

http://query.yahooapis.com/v1/public/yql?q...callback=cbfunc

I get an HTTP 200 OK response an the response body is:

cbfunc({"error":{"lang":"en-US","description":"Authentication Error. The table social.profile requires a higher security level than is provided, you provided ANY but at least APP is expected"}});

Does anyone know what's the problem here? I have configured my application with access to private user data, (especially read access to Yahoo! Profile )
The Authorization header has the following content:
OAuth oauth_token="A%3DOMdyjfniultuw8NiG0x1NhHemcwzkgkGbH7L72yE4PaFxoMR0svop1wKCGtuMRlhVYyKlb.82Hg8OD
vyt2Abn2DyqVl_wuRqC0ustkaXyOGu_vL4Ii1WSt58JIZCXPc_1PzLM.ZpfYfrZ4XRBpIrodsFBeFj8dO
rJxKOsEw.HrTqu5icaMlo60uZtrwcESDNDeAKgjqmjcfYHxraBbp6gKEmKsZQQYpF67w.ncj_Q0FvxD9S
cCJeiL0Pc4Cla2E4tcmXhB_thJVaAq4qdVH5iYqogV4Z3L.iMt7SoIiv4TWMgyS1bPSvzryz52WgoOCnZ
1HCQUlqeshQcEIroEJpeYhmEGWrE7Xp84hVIBIapti8Pwys3lU18eIGbr7P0vgjhDMsOX3E5ATupHFzK9
P1nvhzINBrvMglqc2qmfkViB9iEvwkoKEppUjEsH1vjEhBs3BaN29LQ_Uk2642C537QMUauihROegsXjP
T9B8KIoF85ITl9g0d7qnNJWIrIyCvbZvDIWq4ddjSWdd1SRoFq_Gwx__6Il86fSzX9635Tco8XXZKOoXA
8kk8.mSIY7be44XlEefQtnrfcWa_O1LF1l6ugFg07tjM3Th4j_oxIG9QUCTFgN8hnhKhtWAvAJFvkWMEs
npsypU2YHUKuf2JgMwA3s4jLZRiwhx2mg3pl1qM5kfy2s8FAvDmv149ddWtQG1zJ8KqW4u0_pazRNa7Bf
Tnm4HbJiY6PxwMQmuAb4hdf7gi9bxeUwvn.Egby5LdQGz0H9SXb_7f3S2NLjtuQX3vQ41fZCINeODwKpH
RFP_Jm2vpTpafN3F76xx-",
oauth_verifier="6zecbw",
oauth_consumer_key="dj0yJmk9UnlWaDk2TWFxdTQyJmQ9WVdrOVJqTlFRVWw0TjJjbWNHbzlNVEUwTXpJMk1EQTJNZy0
tJnM9Y29uc3VtZXJzZWNyZXQmeD1jMg--",
oauth_version="1.0",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1273848084",
oauth_nonce="-2268027110966796908",
oauth_signature="rNEXt2rc37XrCchz2LWjZ1QAy%2FYxx"



That is java servlet code I use:

CODE
    @Override
protected ModelAndView showForm(final HttpServletRequest originalrequest, final HttpServletResponse response, final BindException errors) throws Exception {
OAuthConsumer consumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
OAuthProvider provider = new DefaultOAuthProvider("https://api.login.yahoo.com/oauth/v2/get_request_token", "https://api.login.yahoo.com/oauth/v2/get_token",
"https://api.login.yahoo.com/oauth/v2/request_auth");
provider.setOAuth10a(true);

final Map<String, Object> model = new HashMap<String, Object>();

String parameterTok = originalrequest.getParameter("oauth_token");
String parameterVer = originalrequest.getParameter("oauth_verifier");

if (parameterTok == null || parameterVer == null) {
// /STEP 1 ///
String authUrl = provider.retrieveRequestToken(consumer, "http://mydomain.com:8080/yahooauthorization/yahooinfo.html");
requestParameters = consumer.getRequestParameters();
this.tokenSecret = consumer.getTokenSecret();

model.put("text", authUrl); //here the user is redirected to authUrl via javascript

final ModelAndView showForm = super.showForm(originalrequest, response, errors, model);
return showForm;
} else {
// STEP 3, user has to be authenticated //
consumer.setTokenWithSecret(parameterTok, tokenSecret);
provider.retrieveAccessToken(consumer, parameterVer);

// make 3-legged user info request
HttpPost request = new HttpPost(
"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20social.profile%20where%20guid%3Dme&format=json&diagnostics=true&callback=cbfunc");

HttpParameters params = new HttpParameters();
params.put("realm", "yahooapis.com");
consumer.setAdditionalParameters(params);
// sign the request
consumer.sign(request);

HttpClient httpClient = new DefaultHttpClient();
HttpResponse response2 = httpClient.execute(request);

String res = "Response: " + response2.getStatusLine().getStatusCode() + " " + response2.getStatusLine().getReasonPhrase();
System.out.println(res);
StringBuilder responsebody = readBody(response2.getEntity().getContent());

model.put("parameter", "token:" + parameterTok + ", verifier:" + parameterVer);
model.put("response", res + " responsebody: " + responsebody);
return new ModelAndView("signpost", model);
}
}

private StringBuilder readBody(InputStream is) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(is));
String inputLine;

StringBuilder builder = new StringBuilder();
while ((inputLine = in.readLine()) != null)
builder.append(inputLine);
in.close();
return builder;
}



Thank you for your help !

by
2 Replies

Recent Posts

in YQL