# I lost authentication token, how do i get it

**URL:** <https://www.ruby-forum.com/t/i-lost-authentication-token-how-do-i-get-it/177625>\
**Category:** Rails\
**Created:** [October 21, 2009, 8:34am UTC](https://www.ruby-forum.com/t/i-lost-authentication-token-how-do-i-get-it/177625 "2009-10-21T08:34:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aashishkiran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@aashishkiran](https://www.ruby-forum.com/u/aashishkiran)\
**Post date:** [October 21, 2009, 8:34am UTC](https://www.ruby-forum.com/t/i-lost-authentication-token-how-do-i-get-it/177625/1 "2009-10-21T08:34:39Z")

</div>

I lost authentication token, how do i get it. I followed the link

> **[Using Ruby with the Google Data APIs  |  Google for Developers](https://developers.google.com/gdata/articles/using_ruby?csw=1)**

In Authentication | Using the Google Spreadsheets API section

detailed explanation  
--------------------------------code  
starts--------------------------------------  
irb(main):008:0\> require ‘net/https’  
=\> true  
irb(main):009:0\> http = Net::HTTP.new(‘[www.google.com](http://www.google.com)’, 443)  
=\> #\<Net::HTTP [www.google.com:443](http://www.google.com:443) open=false\>  
irb(main):010:0\> http.use\_ssl = true  
=\> true  
irb(main):011:0\> path = ‘/accounts/ClientLogin’  
=\> “/accounts/ClientLogin”

# Now we are passing in our actual authentication data.

# Please visit this link for more information

In Authentication | Using the Google Spreadsheets API  
section

# about the accountType parameter

irb(main):014:0\> data =   
irb(main):015:0\* ‘accountType=HOSTED\_OR\_GOOGLE&Email=your email’   
irb(main):016:0\* ‘&Passwd=your password’   
irb(main):017:0\* ‘&service=wise’

=\> accountType=HOSTED\_OR\_GOOGLE&Email=your email&Passwd=your  
password&service=wise"

# Set up a hash for the headers

irb(main):018:0\> headers =   
irb(main):019:0\* { ‘Content-Type’ =\> ‘application/x-www-form-  
urlencoded’}  
=\> {“Content-Type”=\>“application/x-www-form-urlencoded”}

# Post the request and print out the response to retrieve our

authentication token  
irb(main):020:0\> resp, data = http.post(path, data, headers)  
warning: peer certificate won’t be verified in this SSL session  
=\> [#\<Net::HTTPOK 200 OK readbody=true\>, "SID=DQAAAIIAAADgV7j4F-  
QVQjnxdDRjpslHKC3M … [ snipping out the rest of the authentication  
strings ]  
-------------------------------------------code  
ends---------------------------------------

after executing above steps i got auth token. Now I accidentally  
changed some characters. That is the mistake I have done. So, I  
startted newly from the beginning, but when I run  
this step.  
--------------------------------code  
starts--------------------------------------  
resp, data = http.post(path, data, headers)  
-------------------------------------------code  
ends---------------------------------------

I am getting error as follows  
--------------------------------code  
starts--------------------------------------

C:\Documents and Settings\Administrator\>irb  
irb(main):001:0\>  
irb(main):002:0\* require ‘net/https’  
=\> true  
irb(main):003:0\> http = Net::HTTP.new(‘[www.google.com](http://www.google.com)’, 443)  
=\> #\<Net::HTTP [www.google.com:443](http://www.google.com:443) open=false\>  
irb(main):004:0\> path = ‘/accounts/ClientLogin’  
=\> “/accounts/ClientLogin”  
irb(main):005:0\> data =   
irb(main):006:0\*  
‘accountType=HOSTED\_OR\_GOOGLE&Email=removed\_email\_address@domain.invalid’   
irb(main):007:0\* ‘&Passwd=aassssaa’   
irb(main):008:0\* ‘&service=finance’  
=\>  
“accountType=HOSTED\_OR\_GOOGLE&Email=removed\_email\_address@domain.invalid&Passwd=aassssaa&service=finance”  
irb(main):009:0\> headers =   
irb(main):010:0\* { ‘Content-Type’ =\> ‘application/x-www-form-  
urlencoded’}  
=\> {“Content-Type”=\>“application/x-www-form-urlencoded”}  
irb(main):011:0\> resp, data = http.post(path, data, headers)  
EOFError: end of file reached  
from c:/ruby/lib/ruby/1.8/net/protocol.rb:133:in `sysread' from c:/ruby/lib/ruby/1.8/net/protocol.rb:133:in `rbuf\_fill’  
from c:/ruby/lib/ruby/1.8/timeout.rb:56:in `timeout' from c:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout’  
from c:/ruby/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill' from c:/ruby/lib/ruby/1.8/net/protocol.rb:116:in `readuntil’  
from c:/ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline' from c:/ruby/lib/ruby/1.8/net/http.rb:2029:in `read\_status\_line’  
from c:/ruby/lib/ruby/1.8/net/http.rb:2018:in `read_new' from c:/ruby/lib/ruby/1.8/net/http.rb:1059:in `request’  
from c:/ruby/lib/ruby/1.8/net/http.rb:1046:in `request' from c:/ruby/lib/ruby/1.8/net/http.rb:547:in `start’  
from c:/ruby/lib/ruby/1.8/net/http.rb:1044:in `request' from c:/ruby/lib/ruby/1.8/net/http.rb:854:in `post’  
from (irb):11  
irb(main):012:0\>  
-------------------------------------------code  
ends---------------------------------------

can anyone help me in solving this

---

<div class="post-metadata">

**Author:** ![aashishkiran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@aashishkiran](https://www.ruby-forum.com/u/aashishkiran)\
**Post date:** [October 21, 2009, 9:46am UTC](https://www.ruby-forum.com/t/i-lost-authentication-token-how-do-i-get-it/177625/2 "2009-10-21T09:46:16Z")

</div>

On Oct 21, 7:34 am, Aashish K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> can anyone help me in solving this

You didn’t set use\_ssl to true the second time.

Fred
