Hi all, When I run my ClientLogin module on my computer, it works fine. It returns auth token string. But after deploying it to google app engine, it returns 403 code with the following message.
CaptchaToken=RMqDsLYF5GwsSL6KLWqYaaChamqisc6Gfay8HaQZrVfL5VZmVF2oGR9rwd7kVfUBGJf48BXIYBPPIkvoJBz0ONgR0s3H5YL78ZqEV- kp94k:qV64LJNmvzVd_pnZnRBP9A CaptchaUrl=Captcha? ctoken=RMqDsLYF5GwsSL6KLWqYaaChamqisc6Gfay8HaQZrVfL5VZmVF2oGR9rwd7kVfUBGJf48BXIYBPPIkvoJBz0ONgR0s3H5YL78ZqEV- kp94k%3AqV64LJNmvzVd_pnZnRBP9A Error=CaptchaRequired Url=https://www.google.com/accounts/ErrorMsg?Email=tiglek %40gmail.com&service=cl&id=cr&timeStmp=1268138144&secTok=78f966c80fe6117b34ad3ffbbbeccb1f I think there is no problem on my request because it works fine on my computer. Have you ever experienced this case? The code for ClientLogin module is as follows: <code> private final static String CLIENT_LOGIN_URL = "https:// www.google.com/accounts/ClientLogin"; public static String doClientLogin(String email, String pw, String appName, String serviceName) { StringBuffer buf = new StringBuffer(200); try { URL url = new URL(CLIENT_LOGIN_URL); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); // // set authentication parameters connection.setDoOutput(true); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/ x-www-form-urlencoded"); try { buf.append("Email=").append(URLEncoder.encode(email, "UTF-8")).append("&"); buf.append("Passwd=").append(URLEncoder.encode(pw, "UTF-8")).append("&"); buf.append("source=").append(appName).append("&"); buf.append("service=").append(serviceName).append("&"); // the name of service for login buf.append("accountType=HOSTED_OR_GOOGLE"); } catch ( UnsupportedEncodingException uee ) { uee.printStackTrace(); return null; } connection.setRequestProperty("Content-Length", Integer.toString(buf.length())); // // send request OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(buf.toString()); writer.close(); buf.setLength(0); // // check response code int resCode = connection.getResponseCode(); if ( resCode == HttpURLConnection.HTTP_OK || resCode == 403 ) { BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; while ((line = reader.readLine()) != null) { log.warning("Line:" + line); if ( resCode == HttpURLConnection.HTTP_OK && line.startsWith("Auth=") ) { buf.append(line.substring(5)); break; } } reader.close(); } else { log.warning("GoogleLogin.doClientLogin(): ResponseCode:" + resCode); // Server returned HTTP error code. } } catch (MalformedURLException e) { // ... } catch (IOException e) { // ... } return buf.toString(); } </code> -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
