niko-dunixi / google-voice-java

Automatically exported from code.google.com/p/google-voice-java
0 stars 0 forks source link

Not able to login to Voice - depricated client login , now unavailable. #60

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Voice voice = new Voice("username","pwd");

returns Nullpointer exception , 
https://www.google.com/accounts/ClientLogin - Not Found

Please provide any additional information below.

Important: ClientLogin has been officially deprecated since April 20, 2012 and 
is now no longer available. Requests to ClientLogin will fail with a HTTP 404 
response. We encourage you to migrate to OAuth 2.0 as soon as possible.

Original issue reported on code.google.com by kkgarage...@gmail.com on 1 Jun 2015 at 6:04

GoogleCodeExporter commented 9 years ago
I wonder what it will take to update this to use OAth2.  I don't have any time 
this week to figure it out, but I'm sure (hopefully) that someone else will be 
able to look at this.

At one point, I was looking to make this use an AuthKey instead of username and 
password (i.e. - support 2-step Authentication).

Original comment by joseph.c...@gmail.com on 8 Jun 2015 at 2:02

GoogleCodeExporter commented 9 years ago
I also face the same issue.

Original comment by ninad.so...@gmail.com on 25 Jun 2015 at 11:33

GoogleCodeExporter commented 9 years ago
I just encountered this issue as well. I have only a bit of familiarity with 
the code in this project but will dive in further today. Someone with OAuth 2.0 
experience would probably be better equipped to make the needed changes.

Original comment by ro...@cauvin.org on 26 Jun 2015 at 6:34

GoogleCodeExporter commented 9 years ago
This project supposedly has a working Google Voice login: 
https://github.com/twyatt/gv4j. The login is implemented in this file: 
https://github.com/twyatt/gv4j/blob/master/src/main/java/com/brewengine/gv4j/GV.
java.

Original comment by ro...@cauvin.org on 27 Jun 2015 at 10:50

GoogleCodeExporter commented 9 years ago
Hi, I would like to know if somebody has already started to try the OAuth 
addition to this project. I'm a java dev and I could look into comment #4 
solution and try to add this to the current project.

Thanks !

Original comment by mickael....@gmail.com on 4 Jul 2015 at 2:58

GoogleCodeExporter commented 9 years ago
I was able to get things working by:

1. Extracting cookies from the accountURLString below.
2. Doing an HTTP POST to the loginURLString below (passing the cookies obtained 
in step 1).
3. Following all redirects and meta refreshes, storing and retrieving cookies 
along the way.
4. Continuing to store and retrieve cookies when making any subsequent HTTP 
requests.

Unfortunately, the code I have so far isn't particularly polished, and it fails 
when Google prompts to associate a verification phone number for the Google 
account. (I worked around this problem by manually logging in and dismissing 
the verfication prompt.)

  /** The Constant loginURLString. */
  final static String loginURLString = "https://accounts.google.com/ServiceLoginAuth";

  /** The Constant accountURLString. */
  final static String accountURLString = "https://accounts.google.com/ServiceLogin?service=grandcentral&continue=https://www.google.com/voice&followup=https://www.google.com/voice";

...
...
...

  String data = URLEncoder.encode("GALX", enc) + "=" + URLEncoder.encode(galx, enc);
  data += "&" + URLEncoder.encode("continue", enc) + "=" + URLEncoder.encode("https://www.google.com/voice#inbox", enc);
  data += "&" + URLEncoder.encode("followup", enc) + "=" + URLEncoder.encode("https://www.google.com/voice#inbox", enc);
  data += "&" + URLEncoder.encode("service", enc) + "=" + URLEncoder.encode(SERVICE, enc);
  data += "&" + URLEncoder.encode("_utf8", enc) + "=" + URLEncoder.encode("☃", enc);
  data += "&bgresponse=js_disabled";
  data += "&pstMsg=0";
  data += "&dnConn=";
  data += "&checkConnection=";
  data += "&checkedDomains=youtube";
  data += "&" + URLEncoder.encode("Email", enc) + "=" + URLEncoder.encode(user, enc);
  data += "&" + URLEncoder.encode("Passwd", enc) + "=" + URLEncoder.encode(pass, enc);
  data += "&" + URLEncoder.encode("signIn", enc) + "=" + URLEncoder.encode("Sign in", enc);
  data += "&PersistentCookie=yes";
  data += "&" + URLEncoder.encode("source", enc) + "=" + URLEncoder.encode(source, enc);

  if (pCaptchaAnswer!=null && pCaptchaToken!=null) {
    data += "&" + URLEncoder.encode("logintoken", enc) + "="
      + URLEncoder.encode(pCaptchaToken, enc);
    data += "&" + URLEncoder.encode("logincaptcha", enc) + "="
      + URLEncoder.encode(pCaptchaAnswer, enc);

Original comment by ro...@cauvin.org on 4 Jul 2015 at 6:44

GoogleCodeExporter commented 9 years ago
w.r.t. comment #6 ro...@cauvin.org,
Can you please post the complete code?

Original comment by ninad.so...@gmail.com on 6 Jul 2015 at 12:54

GoogleCodeExporter commented 9 years ago
Anyone come up with a viable solution for this issue?

Original comment by ang...@foxtailtech.com on 5 Aug 2015 at 3:58

GoogleCodeExporter commented 9 years ago
I outlined the solution that worked for me in comment #6. It's still working 
just fine for me for connecting to Google Voice and sending SMS.

I didn't go through and update every endpoint in the API and test that each of 
them still works. So it doesn't seem like a good idea for me to post the code 
to the repository.

But see the attachment for what I have for 
com.techventus.server.voice.Voice.java if it helps.

Original comment by ro...@cauvin.org on 10 Aug 2015 at 3:36

Attachments:

frankzvovu commented 7 years ago

I appreciate you posting that source but the compiler is failing to find the http. and string. packages. Where can I find those?