Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to Sign in to Google Account from Eclipse Oxygen #2148

Closed
sanc-enovate opened this issue Jul 14, 2017 · 11 comments
Closed

Not able to Sign in to Google Account from Eclipse Oxygen #2148

sanc-enovate opened this issue Jul 14, 2017 · 11 comments

Comments

@sanc-enovate
Copy link

  • Cloud Tools for Eclipse Version: 1.2.0.201706082053
  • OS: Mac OS X 10.12.5
  • Java Version: 1.8.0_40
    Eclipse Oxygen : 4.7

Issue : Sign in to Google is not working.

I am new to Google Cloud tools and facing problem at very first step where I need to sign in to Google account.
When I hit "Sign in to Google" It opened the login process in external browser(Chrome), After login and giving permission, It redirects to localhost:RANDOM_PORT/Callback?code=xxxxxx

This URL doesn't exist and showing "This site can’t be reached", standard google chrome page ,

In eclipse, Showing processing dialog window with Cancel option.

Not sure why callback redirection is to a Random localhost port ?

Additional information:
I tried with Safari and result is same.

@chanseokoh
Copy link
Contributor

chanseokoh commented Jul 14, 2017

Can you clarify if what you see is the literal string "RANDOM_PORT"? If so, that's certainly a bug. (However, it is correct that it should be some random localhost port.)

@sanc-enovate
Copy link
Author

sanc-enovate commented Jul 14, 2017 via email

@chanseokoh
Copy link
Contributor

I see. At least it is correct that it redirects to a random localhost port. When the login browser launches, our CT4E plugin also listens from the port locally to receive the code value. Let me check what could go wrong.

@chanseokoh
Copy link
Contributor

chanseokoh commented Jul 14, 2017

The fact that you see actual random port numbers very likely suggests that the local web server is up and running (in-process, and not as a separate process).

I suspect your browser is blocked from accessing "http://localhost", perhaps due to your proxy settings. Can you update your browser proxy settings so that localhost addresses bypass the proxy?

@sanc-enovate
Copy link
Author

sanc-enovate commented Jul 14, 2017 via email

@briandealwis
Copy link
Member

Are you behind a firewall or anti-virus?

Could you check your <workspace>/.metadata/.log?

@chanseokoh
Copy link
Contributor

chanseokoh commented Jul 14, 2017

First, let's check if the local web server is listening, and then try to connect to the local web server from other clients than browsers, such as wget in the terminal.

Let Eclipse be the only Java process. netstat -tlnp will give you listening TCP ports with process names. I recommend restarting Eclipse before doing this. Normally, there shouldn't be any Java process.

$ netstat -tlnp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:30003         0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:9557          0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:9558          0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:9559          0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:45596           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:8103            0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:999           0.0.0.0:*               LISTEN      -               
tcp6       0      0 :::31337                :::*                    LISTEN      -               
tcp6       0      0 :::44681                :::*                    LISTEN      -               
tcp6       0      0 :::12589                :::*                    LISTEN      -               
tcp6       0      0 :::111                  :::*                    LISTEN      -               
tcp6       0      0 :::9554                 :::*                    LISTEN      -               
tcp6       0      0 :::9555                 :::*                    LISTEN      -               
tcp6       0      0 ::1:9557                :::*                    LISTEN      -               
tcp6       0      0 ::1:9558                :::*                    LISTEN      -               
tcp6       0      0 :::22                   :::*                    LISTEN      -               
tcp6       0      0 ::1:9559                :::*                    LISTEN      -               
tcp6       0      0 ::1:631                 :::*                    LISTEN      -               
tcp6       0      0 :::3900                 :::*                    LISTEN      -               
tcp6       0      0 :::3901                 :::*                    LISTEN      -               
tcp6       0      0 :::8224                 :::*                    LISTEN      -               
tcp6       0      0 :::12513                :::*                    LISTEN      -               
tcp6       0      0 :::32100                :::*                    LISTEN      -               
tcp6       0      0 :::32101                :::*                    LISTEN      -               
tcp6       0      0 :::8103                 :::*                    LISTEN      -               

Then, click on the login button in Eclipse. When the "Sign in to Google" dialog pops up, check which port is open. There will be one Java process:

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:30003         0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:9557          0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:9558          0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:9559          0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:45596           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:8103            0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:999           0.0.0.0:*               LISTEN      -               
tcp6       0      0 :::31337                :::*                    LISTEN      -               
tcp6       0      0 :::44681                :::*                    LISTEN      -               
tcp6       0      0 :::12589                :::*                    LISTEN      -               
tcp6       0      0 :::111                  :::*                    LISTEN      -               
tcp6       0      0 :::9554                 :::*                    LISTEN      -               
tcp6       0      0 :::9555                 :::*                    LISTEN      -               
tcp6       0      0 127.0.0.1:41237         :::*                    LISTEN      101879/java     
tcp6       0      0 ::1:9557                :::*                    LISTEN      -               
tcp6       0      0 ::1:9558                :::*                    LISTEN      -               
tcp6       0      0 :::22                   :::*                    LISTEN      -               
tcp6       0      0 ::1:9559                :::*                    LISTEN      -               
tcp6       0      0 ::1:631                 :::*                    LISTEN      -               
tcp6       0      0 :::3900                 :::*                    LISTEN      -               
tcp6       0      0 :::3901                 :::*                    LISTEN      -               
tcp6       0      0 :::8224                 :::*                    LISTEN      -               
tcp6       0      0 :::12513                :::*                    LISTEN      -               
tcp6       0      0 :::32100                :::*                    LISTEN      -               
tcp6       0      0 :::32101                :::*                    LISTEN      -               
tcp6       0      0 :::8103                 :::*                    LISTEN      -               

So, you now know there is a Java process listening on port 41237. Try

$ wget 127.0.0.1:41237
$ wget localhost:41237

If it returns 404, then at least we know the server is running and it's the browser problem.

HTTP request sent, awaiting response... 404 Not Found
2017-07-14 14:04:37 ERROR 404: Not Found.

@chanseokoh
Copy link
Contributor

chanseokoh commented Jul 14, 2017

I sometimes see Eclipse listen on some port on its own, so I recommend you check netstat multiple times by clicking on the login button and cancelling the "Sign in to Google" dialog.

@chanseokoh
Copy link
Contributor

chanseokoh commented Jul 14, 2017

Also, hitting /Callback?error=whatever will return 200 or 302, so this is the sure thing to know if the server is the right one. When returning 200 or 302 with this URL, the server dies, and the "Sign in to Google" dialog in Eclipse will disappear.

$ wget 127.0.0.1:60039/Callback?error=killtest
--2017-07-14 14:18:16--  http://127.0.0.1:60039/Callback?error=killtest
Connecting to 127.0.0.1:60039... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘Callback?error=killtest’

    [ <=>                                                                                                                                             ] 159         --.-K/s   in 0s      

2017-07-14 14:18:16 (20.7 MB/s) - ‘Callback?error=killtest’ saved [159]

(BTW, delete the unnecessary file that wget downloaded.)

@sanc-enovate
Copy link
Author

sanc-enovate commented Jul 14, 2017 via email

@chanseokoh
Copy link
Contributor

Seems like this can happen when there are multiple localhost interfaces. We need to let Jetty return the actual host here:

https://github.com/google/google-oauth-java-client/blob/dev/google-oauth-client-jetty/src/main/java/com/google/api/client/extensions/jetty/auth/oauth2/LocalServerReceiver.java#L129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants