【问题标题】:Android : call httpget with redirect_uriAndroid:使用 redirect_uri 调用 httpget
【发布时间】:2013-04-23 04:35:25
【问题描述】:

我想通过 android 应用程序发出 httpget 请求,

 URL = https://www.facebook.com/dialog/oauth?client_id=<number>&redirect_uri=<SOME_URL>&scope=email

上面的 URL 在浏览器上运行良好,它在服务器端给了我正确的结果,但是当我从应用程序进行 http 调用时它不起作用,得到 200 响应,但它不会给我结果。

代码sn-p:

    HttpParams httpParams = new BasicHttpParams();
    httpParams.setParameter(CoreProtocolPNames.PROTOCOL_VERSION,                        HttpVersion.HTTP_1_1);
   HttpConnectionParams.setConnectionTimeout(httpParams,
                            CONN_TIMEOUT);
    HttpGet httpGet = new HttpGet(URL);
    Log.d(TAG,"URL :"+ httpGet.getURI().toURL().toString());            
    DefaultHttpClient client = new DefaultHttpClient(httpParams);

    HttpResponse httpResponse = client.execute(httpGet);            

    //Log.d(TAG,"httpResponse :" +EntityUtils.toString(httpResponse.getEntity()));
    res = httpResponse.getStatusLine().getStatusCode();
    Log.d(TAG, "Response : " + res);

【问题讨论】:

    标签: android facebook redirect uri


    【解决方案1】:

    这是因为

    200 response code "OK"
    The request has succeeded. The information returned with the response is dependent on the method used in the request,if there is some result request code will 204 
    

    【讨论】:

    • @Nimit 你需要检查你的 url 可能不正确,它只用于 post 而不是 get 可能是
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-21
    • 1970-01-01
    • 1970-01-01
    • 2012-09-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多