StevenHickson / PiAUISuite

Raspberry PI AUI Suite
Other
695 stars 210 forks source link

gmail 2 step verification #2

Open linwiz opened 11 years ago

linwiz commented 11 years ago

Does this support google's 2 step verification? I cannot seem to get gtextcommand to login properly.

adaprime commented 11 years ago

You should create an application specific password - https://accounts.google.com/IssuedAuthSubTokens

linwiz commented 11 years ago

Wow, super fast reply. Still no dice with application specific password

pi@raspberrypi ~/PiAUISuite $ ./TextCommand/gtextcommand Failed to find rnr_se token. (Most likely a bad/mistyped email/passwd) gv.Login() returned -2.

Failed to find rnr_se token. (Most likely a bad/mistyped email/passwd)

StevenHickson commented 11 years ago

Hmmm I've never tried it with 2 step verification. It depends on how google uses those. I didn't have that in mind when I wrote it. I'll take a look into it and see if I can figure anything out.

linwiz commented 11 years ago

I'm not a C coder, but i'm attempting to debug what credentials are being passed to login. shouldn;t be any issues, but to be safe..

edit: they are in fact being passed correctly. I'm not sure whats going on here.

StevenHickson commented 11 years ago

It is working properly on my system right now. If you aren't seeing them, then they must not be being loaded properly in gtextcommand.cpp. I would bet your config file isn't proper. It should be located in ~/.gtext

linwiz commented 11 years ago

I have verified that the config ~/.gtext has username password command number

I can only assume this has something to do with 2 step verification.

Edit: 2 step is definitely the problem here. turning it off solved the problem instantly.

StevenHickson commented 11 years ago

Looking through the code. I'm thinking google does a different logon process for 2 step verification. I'll have to enable it on an account and try it out. Until then, it looks you can't use this with the 2 step verification process.

linwiz commented 11 years ago

I dug up this link, there isn't supposed to be any difference i guess http://support.google.com/a/bin/answer.py?hl=en&answer=1032419#api https://developers.google.com/google-apps/provisioning/auth

StevenHickson commented 11 years ago

Interesting. Let me just confirm 2 things. You have a google voice account already Your username in the file is in the form Username not Username@gmail.com

And it looks like I'm using https://accounts.google.com/ServiceLoginAuth not ClientLogin This may cause a slight difference.

linwiz commented 11 years ago

I cannot get it to work with username@gmail.com or username format, and I do have a voice account, and phone # set up already

StevenHickson commented 11 years ago

Then it's got to be the difference in URL. Apparently ServiceLoginAuth doesn't handle 2 step verification while ClientLogin does. I'll start testing a code with the different links you posted and see if I can get it to work.

StevenHickson commented 11 years ago

Alright. Made some changes and they work for me as normal. Grab the files from here (that's my working code repository): http://stevenhickson-code.googlecode.com/svn/trunk/AUI/TextCommand/ And try it out (Your ~/.gtext file will have to use username@gmail.com) Then let me know if that works out.

linwiz commented 11 years ago

Still no luck, sorry

StevenHickson commented 11 years ago

You ran it from the local directory right? (as in ./gtextcommand instead of gtextcommand) Try running (./gvapi -d1 -u username@gmail.com -p password -i). See if that gives you any errors.

linwiz commented 11 years ago

yes, being run from local directory

Debugging level 1 enabled Got GALX session token: xxxxxxxxxxxxxxxx Failed to find rnr_se token. (Most likely a bad/mistyped email/passwd) gv.Login() returned -2.

Got GALX session token: xxxxxxxxxxxxxxxxx Failed to find rnr_se token. (Most likely a bad/mistyped email/passwd)

linwiz commented 11 years ago

I've created a vanilla google account and set up google voice, no 2 step verification, and it will not login. I don't know if this has anything to do with the changes you made last night or if something else is wrong. Its has the same error as comment above.

I switched back to the github code, and still not working. This is what i'm seeing with the new account on github code:

]

SendSMS curlbuf: [<HTML> <HEAD> <TITLE>Internal Server Error</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Internal Server Error</H1> <H2>Error 500</H2> </BODY> </HTML> ] Something went wrong. Enable debugging. gv.SendSMS() returned -1.

StevenHickson commented 11 years ago

The changes I made last night were specific to the 2 step verification. Try the version from github with your account info. I know it is working right now without 2 step verification.

linwiz commented 11 years ago

If the github code is indeed working for non-2-step accounts, then there must be something wrong with my setup. I'm not sure what, but something.

StevenHickson commented 11 years ago

Yeah I'm trying to figure that out. The github version seems to work with username@gmail.com or just username for me. Try enabling -d3 in gvapi and maybe we can see some detailed info.

linwiz commented 11 years ago

./gtext has the error, Something went wrong. Enable debugging. gv.SendSMS() returned -1.

but ./gvapi -d3 does not have any errors

Debugging level 3 enabled Got GALX session token: xxxxxxxx

Login() curlbuf: [ <html> .... </html> ] Got rnr_se session token: xxxxxxxxxxxxxx gv.Login() returned 0.

StevenHickson commented 11 years ago

Well this is why the 2 step verification isn't working: Important: ClientLogin has been officially deprecated as of April 20, 2012

linwiz commented 11 years ago

fair enough, If only I can get this working again with the new account, I'll just use it solely for this purpose and not have to worry about 2-step verification.

StevenHickson commented 11 years ago

Interesting, are you using the github version of gtextcommand? Looks like something went wrong in the SendSMS function. This means it got a message and checked it and then tried to return you something and then it broke. This seems really odd. Try sending a message to yourself using gvapi. You should be able to do this with gvapi -n 15551234 -m "This is a test" Where 5551234 is your phone number.

linwiz commented 11 years ago

yes, github version. Same problem. I know for a fact it worked last night, as i received a text on my phone from it. not sure what has happened

StevenHickson commented 11 years ago

Weird. Try running the UpdateAUISuite.sh script. Then run it (not locally).

linwiz commented 11 years ago

I ran the update script there is no gtextcommand or gvapi in a /usr/bin directory. tried to run the install again, still not there. I can only run it locally.

StevenHickson commented 11 years ago

Ah, if they aren't already there, pdate won't update them. pull the newest github code with git pull, then run: sudo cp TextCommand/gvapi /usr/bin/ sudo cp TextCommand/gtextcommand /usr/bin/

linwiz commented 11 years ago

ok, ive done that now but it doesn't seem to make a difference where it is being run from, i just keep getting the same error gv.SendSMS() returned -1.

StevenHickson commented 11 years ago

I would try logging into your google voice manually and checking it out. Because this implies that something is going on with your config file or in the actual google voice system. The code hasn't been updated in github since the 14th. So something on your end must have changed between yesterday and today. It might be best to uninstall and then install from scratch just to make sure everything is configured properly.

The problem doesn't really make sense since it implies that you can log in and check the message but cannot send one. I'm able to succesfully send texts to US numbers in the form 5551234, 15551234, and +15551234

linwiz commented 11 years ago

I disabled 2step on my primary again, and it works. the new account does not work with 2step off.

StevenHickson commented 11 years ago

Then it must be something set up incorrectly on your new account. You will have to log onto it in a browser and check the settings.

linwiz commented 11 years ago

I've checked everything I can think of. I am not sure what the problem is with the new account.

StevenHickson commented 11 years ago

I would log on to your new account in a browser on a computer you haven't used before and test it to see if you can send text messages.

linwiz commented 11 years ago

I am able to do that. Have you tried to see if you can create a new account and get this working? maybe they changed something with new accounts, maybe not, i don't know. I've had my primary for 7 years so anything is possible.

linwiz commented 11 years ago

I have done some digging (very little), and i found a PHP library that works to read and send a text message. It should not be hard to figure out where the problem lies. It does work for my new account. https://github.com/aaronpk/Google-Voice-PHP-API

Now the bad news. It does not work with my old account, 2 step or not.

linwiz commented 11 years ago

Scratch that last comment. It does work on both accounts. seems google saw 'someone' logging into my account from afar and thought it was suspicious, blocked it and sent me an email. this php library works nicely. Just need to figure out what the differences are between your program and their script.

StevenHickson commented 11 years ago

Google must have changed something with the new accounts maybe? I haven't been able to use a new account I created because it wanted to link to my phone. It looks like that PHP library is sending some extra flags like &passive=1209600 I'll try adding some of them to see if that helps out.

On Wed, May 22, 2013 at 7:18 PM, linwiz notifications@github.com wrote:

Scratch that last comment. It does work on both accounts. seems google saw 'someone' logging into my account from afar and thought it was suspicious, blocked it and sent me an email. this php library works nicely. Just need to figure out what the differences are between your program and their script.

— Reply to this email directly or view it on GitHubhttps://github.com/StevenHickson/PiAUISuite/issues/2#issuecomment-18314427 .

StevenHickson commented 11 years ago

Actually, I just managed to create a new account (I had to change my number from cell to home in their settings to do this for some reason). And it works with the new account as well. So it has to be either your account settings or something different on your end.

On Wed, May 22, 2013 at 9:57 PM, Steven Hickson me@stevenhickson.comwrote:

Google must have changed something with the new accounts maybe? I haven't been able to use a new account I created because it wanted to link to my phone. It looks like that PHP library is sending some extra flags like &passive=1209600 I'll try adding some of them to see if that helps out.

On Wed, May 22, 2013 at 7:18 PM, linwiz notifications@github.com wrote:

Scratch that last comment. It does work on both accounts. seems google saw 'someone' logging into my account from afar and thought it was suspicious, blocked it and sent me an email. this php library works nicely. Just need to figure out what the differences are between your program and their script.

— Reply to this email directly or view it on GitHubhttps://github.com/StevenHickson/PiAUISuite/issues/2#issuecomment-18314427 .

linwiz commented 11 years ago

Edited: It could be that setting, I don't know, I don't have a second number to add.

@ #issuecomment-18319354 That's what I am starting to think. Hopefully it's not going to be that hard to correct.

As a side note, I actually got side tracked as I usually do. I took that PHP library and mimicked what you've done with this project. It may not be pretty or efficient but it works.

StevenHickson commented 11 years ago

That could be a solution. I'm really confused as to what setting you have enabled that makes it not work.

On Wed, May 22, 2013 at 10:41 PM, linwiz notifications@github.com wrote:

That's what I am starting to think. Hopefully it's not going to be that hard to correct.

As a side note, I actually got side tracked as I usually do. I took that PHP library and mimicked what you've done with this project. It may not be pretty or efficient but it works.

— Reply to this email directly or view it on GitHubhttps://github.com/StevenHickson/PiAUISuite/issues/2#issuecomment-18320410 .

linwiz commented 11 years ago

It's not the best solution, but it works. I'm at a loss, I don't know what the problem is with my account. I think maybe if your new account works fine, then its obviously not the script, its just me. I hope I didn't keep you from any important work.. case closed?

StevenHickson commented 11 years ago

I'll keep it open just in case I can figure things out eventually.

totoDL commented 8 years ago

Hello,

First of all, thank you Steven for that great set of functions. I'm new to RPI (and also to IT development in general) and this really helps.

I started the install of PiAUISuite 2 days ago and face some issues with the set up. Same error than above _Failed to find rnr_se token. (Most likely a bad/mistyped email/passwd) gv.Login() returned -2. Failed to find rnrse token. (Most likely a bad/mistyped email/passwd)

I'm wondering if the phone number setting is the root cause of the issue.. I filled it with a wrong number. :) Do you think this is the root cause ? (or this number is optional) If then, how can I change it (sorry but I'm new in all that and dont know how to modify .gtext which is owned by root and in read-only for my user "pi")...

Thanks in advance for your help