gyasukawa / google-refine

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

OAuth fails on sign in #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using Windows XP, Java Runtime 1.6.0 rev 20, Gridworks r667

Steps to reproduce:
#1 Using a project with columns mapped to Freebase schema.
#2 clicked through to Load into Freebase.
#3 clicked on 'Sign into Freebase'.

The below error is produced (gridworks logging set to verbose), and json 
dumped as a file in the browser.

19:11:19.031 [                  servlet]  > GET check-authorization (16ms)
19:11:19.078 [                  servlet]  < GET check-authorization (47ms)
19:11:30.781 [                  servlet]  > GET authorize (11703ms)
19:11:32.859 [     org.apache.http.wire]   >> "POST 
/api/oauth/request_token HTTP/1.1[EOL]" (2078ms)
19:11:32.859 [     org.apache.http.wire]   >> "Authorization: OAuth 
realm="freebase.com", 
oauth_callback="http%3A%2F%2F127.0.0.1%3A3333%2Fcommand%2Fauthorize%2Fwww.f
reebase.com", oauth_consumer_key="%239202a8c04000641f80000000keykey", 
oauth_version="1.0", oauth_signature_method="HMAC-SHA1", 
oauth_timestamp="1273504291", oauth_nonce="-6157124724385079801", 
oauth_signature="S872Vk0YA7IaMnz31IA88signature"[EOL]" (0ms)
19:11:32.859 [     org.apache.http.wire]   >> "Content-Length: 0[EOL]"(0ms)
19:11:32.859 [     org.apache.http.wire]   >> "Host: 
www.freebase.com[EOL]"(0ms)
19:11:32.859 [     org.apache.http.wire]   >> "Connection: Keep-
Alive[EOL]"(0ms)
19:11:32.859 [     org.apache.http.wire]   >> "User-Agent: Apache-
HttpClient/4.0.1 (java 1.5)[EOL]" (0ms)
19:11:32.859 [     org.apache.http.wire]   >> "[EOL]" (0ms)
19:11:33.171 [     org.apache.http.wire]   << "HTTP/1.0 400 Bad 
Request[EOL]" (312ms)
19:11:33.187 [     org.apache.http.wire]   << "Date: Mon, 10 May 2010 
15:17:25 GMT[EOL]" (16ms)
19:11:33.187 [     org.apache.http.wire]   << "Server: Apache[EOL]" (0ms)
19:11:33.187 [     org.apache.http.wire]   << "WWW-Authenticate: OAuth 
realm="http://freebase.com/"[EOL]" (0ms)
19:11:33.187 [     org.apache.http.wire]   << "X-Metaweb-Cost: cc=0.004, 
dt=0.009, mcs=0.0, mcu=0.0, minflt=4, nvcsw=10, oublock=8, tm=0.0, 
utime=0.004[EOL]" (0ms)
19:11:33.187 [     org.apache.http.wire]   << "Expires: Mon, 10 May 2010 
15:17:26 GMT[EOL]" (0ms)
19:11:33.187 [     org.apache.http.wire]   << "Vary: Accept-Encoding[EOL]" 
(0ms)
19:11:33.187 [     org.apache.http.wire]   << "Content-Length: 368[EOL]" 
(0ms)
19:11:33.187 [     org.apache.http.wire]   << "Content-Type: text/html; 
charset=UTF-8[EOL]" (0ms)
19:11:33.187 [     org.apache.http.wire]   << "X-Cache: MISS from 
cache01.p01.sjc1.metaweb.com[EOL]" (0ms)
19:11:33.187 [     org.apache.http.wire]   << "Connection: keep-alive[EOL]" 
(0ms)
19:11:33.187 [     org.apache.http.wire]   << "X-Metaweb-TID: 
cache;cache01.p01.sjc1:8101;2010-05-10T15:17:25Z;0121[EOL]" (0ms)
19:11:33.187 [     org.apache.http.wire]   << "Set-Cookie: 
metaweb_tid=cache%3Bcache01.p01.sjc1%3A8101%3B2010-05-
10T15%3A17%3A25Z%3B0121; path=/[EOL]" (0ms)
19:11:33.187 [     org.apache.http.wire]   << "Cache-Control: public, no-
cache="Set-Cookie", max-age=1, s-maxage=1, stale-while-revalidate=1[EOL]" 
(0ms)
19:11:33.187 [     org.apache.http.wire]   << "[EOL]" (0ms)
19:11:33.234 [     org.apache.http.wire]   << "400 Bad Request[\n]" (47ms)
19:11:33.234 [     org.apache.http.wire]   << "[\n]" (0ms)
19:11:33.234 [     org.apache.http.wire]   << "The server could not comply 
with the request since it is either malformed or otherwise incorrect. [\n]" 
(0ms)
19:11:33.234 [     org.apache.http.wire]   << "[\n]" (0ms)
19:11:33.234 [     org.apache.http.wire]   << " {'status': '400 Bad 
Request', 'code': '/api/status/error/oauth', 'messages': [{'info': {}, 
'message': 'Expired timestamp: given 1273504291 and now 1273504645 has a 
greater difference than threshold 300', 'code': 
'/api/status/error/request/error'}]}  " (0ms)
19:11:33.234 [                  command]   Exception caught (0ms)
oauth.signpost.exception.OAuthCommunicationException: Communication with 
the service provider failed: Service provider responded in error: 400 (Bad 
Request)
       at 
oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.ja
va:214)
       at 
oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProv
ider.java:69)
       at 
com.metaweb.gridworks.commands.auth.AuthorizeCommand.doGet(AuthorizeCommand
.java:52)
       at 
com.metaweb.gridworks.GridworksServlet.doGet(GridworksServlet.java:211)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
       at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
       at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
       at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
       at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
       at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
       at 
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
       at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
       at org.mortbay.jetty.Server.handle(Server.java:326)
       at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
       at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnecti
on.java:923)
       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
       at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
       at 
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:2
28)
       at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(UnknownSource)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(UnknownSource)
       at java.lang.Thread.run(Unknown Source)
Caused by: oauth.signpost.exception.OAuthCommunicationException: Service 
provider responded in error: 400 (Bad Request)
       at 
oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(Abstrac
tOAuthProvider.java:241)
       at 
oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.ja
va:189)
       ... 22 more
19:11:33.234 [                  servlet]  < GET authorize (0ms)

Original issue reported on code.google.com by iainsproat on 10 May 2010 at 4:14

GoogleCodeExporter commented 9 years ago
Ah-ha! "Expired timestamp: given 1273504291 and now 1273504645 has a 
greater difference than threshold 300"

I think your computer clock might be off... oh boy, this is going to be 
interesting to fix.

At the very least, could you try running a NTP client to keep your clock in 
synch and see if that solves the 
problem?

Other beta testers reported this issue but they were never able to give me 
enough info to understand what was 
going on, thanks much!

Original comment by stefano.mazzocchi@gmail.com on 10 May 2010 at 4:27

GoogleCodeExporter commented 9 years ago

Original comment by stefano.mazzocchi@gmail.com on 10 May 2010 at 4:27

GoogleCodeExporter commented 9 years ago

Original comment by stefano.mazzocchi@gmail.com on 10 May 2010 at 4:52

GoogleCodeExporter commented 9 years ago
Updating the clock worked around it nicely, thanks.  If the tolerance limit can 
be 
adjusted, I'd hope it wouldn't be too difficult.

You could determine the time offset by having the client ping freebase for it's 
server timestamp before doing the oAuth.  The tolerance could be increased to 
envelope the offset in timestamps plus some buffer, allowing the oAuth request 
to 
succeed.

At the very least a friendly error message should be displayed. "Your 
computer's 
clock is not synchronised with world time".

Original comment by iainsproat on 10 May 2010 at 5:09

GoogleCodeExporter commented 9 years ago
Yeah, although I think the best way is to call directly an NTP server to get 
that timestamp and avoid any user 
inconvenience.

Original comment by stefano.mazzocchi@gmail.com on 10 May 2010 at 5:27

GoogleCodeExporter commented 9 years ago
Fixed in r704.

Original comment by stefano.mazzocchi@gmail.com on 10 May 2010 at 11:25

GoogleCodeExporter commented 9 years ago
Unfortunately it seems to have introduced a new bug (r708).  On opening the 
Load data 
into Freebase dialog, the below error is seen.  The "sign into freebase" link 
is not 
shown at the bottom of the dialog.

11:07:46.984 [          org.mortbay.log]   Error for /command/check-authorizatio
n/www.freebase.com (0ms)
java.lang.Error: Unresolved compilation problem:
        FreebaseTimeCommonsHttpOAuthConsumer cannot be resolved to a type

        at com.metaweb.gridworks.oauth.OAuthUtilities.getConsumer(OAuthUtilities
.java:46)
        at com.metaweb.gridworks.oauth.OAuthUtilities.getConsumer(OAuthUtilities
.java:54)
        at com.metaweb.gridworks.util.FreebaseUtils.getUserInfo(FreebaseUtils.ja
va:59)
        at com.metaweb.gridworks.commands.auth.CheckAuthorizationCommand.doGet(C
heckAuthorizationCommand.java:36)
        at com.metaweb.gridworks.GridworksServlet.doGet(GridworksServlet.java:21
1)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511
)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
90)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav
a:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1
82)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:7
65)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)

        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1
52)
        at org.mortbay.jetty.Server.handle(Server.java:326)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:54
2)
        at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpCo
nnection.java:923)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.
java:228)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Original comment by iainsproat on 11 May 2010 at 7:13

GoogleCodeExporter commented 9 years ago
did you recompile?

Original comment by stefano.mazzocchi@gmail.com on 11 May 2010 at 7:25

GoogleCodeExporter commented 9 years ago
My bad - I was compiling the wrong branch (my working copy).  I'd modified 
.classpath, 
hence it wasn't updated by SVN and wasn't compiling 
FreebaseTimeCommonsHttpOAuthConsumer.

Original comment by iainsproat on 11 May 2010 at 8:08

GoogleCodeExporter commented 9 years ago
I cant find the issue solved yet. 

In my case, 
I downloaded the latest build - r878 for Linux. 

However, when I try to load into Freebase, it pops out a window to authorize, 
and the authorization never completes. Everytime I click Connect Button, it 
throws me back to the same Connect/Cancel page. 

In my case here in the log file, I can see something like this. 

19:20:47.008 [                    oauth]  Got remote timestamp 1279892146793 
(0ms)
19:20:47.805 [     org.apache.http.wire]  >> "POST /api/oauth/request_token 
HTTP/1.1[EOL]" (797ms)
19:20:47.806 [     org.apache.http.wire]  >> "Authorization: OAuth 
realm="freebase.com", 
oauth_callback="http%3A%2F%2Flocalhost%3A3333%2Fcommand%2Fauthorize%2Fwww.freeba
se.com", oauth_consumer_key="%239202a8c04000641f80000000150979b7", 
oauth_version="1.0", oauth_signature_method="HMAC-SHA1", 
oauth_timestamp="1279892146", oauth_nonce="566194627225361290", 
oauth_signature="wGaLTIhEyMaI875jXXDwCsyOcaw%3D"[EOL]" (1ms)
19:20:47.806 [     org.apache.http.wire]  >> "Content-Length: 0[EOL]" (0ms)
19:20:47.806 [     org.apache.http.wire]  >> "Host: www.freebase.com[EOL]" (0ms)
19:20:47.806 [     org.apache.http.wire]  >> "Connection: Keep-Alive[EOL]" (0ms)
19:20:47.806 [     org.apache.http.wire]  >> "User-Agent: 
Apache-HttpClient/4.0.1 (java 1.5)[EOL]" (0ms)
19:20:47.806 [     org.apache.http.wire]  >> "[EOL]" (0ms)
19:20:48.594 [     org.apache.http.wire]  << "HTTP/1.0 200 OK[EOL]" (788ms)
19:20:48.594 [     org.apache.http.wire]  << "Date: Fri, 23 Jul 2010 13:35:48 
GMT[EOL]" (0ms)
19:20:48.594 [     org.apache.http.wire]  << "Server: Apache[EOL]" (0ms)
19:20:48.595 [     org.apache.http.wire]  << "WWW-Authenticate: OAuth 
realm="http://freebase.com/"[EOL]" (1ms)
19:20:48.595 [     org.apache.http.wire]  << "X-Metaweb-Cost: cc=0.015, 
dt=0.019, mcs=0.0, mcu=0.0, minflt=2, nvcsw=22, tm=0.0, utime=0.015[EOL]" (0ms)
19:20:48.595 [     org.apache.http.wire]  << "ETag: 
f70807526891af1c700d8c6ba444ede5[EOL]" (0ms)
19:20:48.595 [     org.apache.http.wire]  << "Expires: Fri, 23 Jul 2010 
13:35:49 GMT[EOL]" (0ms)
19:20:48.595 [     org.apache.http.wire]  << "Vary: Accept-Encoding[EOL]" (0ms)
19:20:48.595 [     org.apache.http.wire]  << "Content-Length: 172[EOL]" (0ms)
19:20:48.595 [     org.apache.http.wire]  << "Content-Type: text/html; 
charset=utf-8[EOL]" (0ms)
19:20:48.595 [     org.apache.http.wire]  << "X-Cache: MISS from 
cache04.p01.sjc1.metaweb.com[EOL]" (0ms)
19:20:48.595 [     org.apache.http.wire]  << "Connection: keep-alive[EOL]" (0ms)
19:20:48.595 [     org.apache.http.wire]  << "X-Metaweb-TID: 
cache;cache04.p01.sjc1:8101;2010-07-23T13:35:48Z;0024[EOL]" (0ms)
19:20:48.595 [     org.apache.http.wire]  << "Set-Cookie: 
metaweb_tid=cache%3Bcache04.p01.sjc1%3A8101%3B2010-07-23T13%3A35%3A48Z%3B0024; 
path=/[EOL]" (0ms)
19:20:48.596 [     org.apache.http.wire]  << "Cache-Control: public, 
no-cache="Set-Cookie", max-age=1, s-maxage=1, stale-while-revalidate=1[EOL]" 
(1ms)
19:20:48.596 [     org.apache.http.wire]  << "[EOL]" (0ms)

=============================

Received at some seconds and its expired just after 1/2 seconds. 

Original comment by dhrubas...@gmail.com on 23 Jul 2010 at 1:55

GoogleCodeExporter commented 9 years ago
Hmm, let me look into it.

Original comment by stefa...@google.com on 23 Jul 2010 at 2:57

GoogleCodeExporter commented 9 years ago

Original comment by stefano.mazzocchi@gmail.com on 23 Jul 2010 at 3:00

GoogleCodeExporter commented 9 years ago
dhrubaster, does it still happen?

Original comment by stefa...@google.com on 16 Aug 2010 at 4:11

GoogleCodeExporter commented 9 years ago
Flagging this as fixed because I can't reproduce (nor can hear back from the 
bug reporter). If this is still an issue, please re-open.

Original comment by stefa...@google.com on 31 Aug 2010 at 6:06

GoogleCodeExporter commented 9 years ago

Original comment by tfmorris on 18 Sep 2012 at 2:21

GoogleCodeExporter commented 9 years ago

Original comment by tfmorris on 18 Sep 2012 at 2:49