contactlaveena / dyuproject

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

Sample program not running locally while trying to acess oauth services like google contacts or any other google services #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. download the demo from http://dyuproject.googlecode.com/files/
dyuproject.appspot.com-source-2009-10-08.zip
2. unzip, install and run it as mentioned in the README.txt in the 
unzipped folder.
3. Try accessing the application over http://localhost:8080/
4. Try using OAuth services - any of the google services e.g. contacts.

What is the expected output? What do you see instead?
It produces a blank page. http://localhost:8080/oauth/google/contacts.
Rather it should show me the contacts after authenticating. This works well
on the hosted - Google apps domain demo. But when i tried locally, it did 
not work. 

What version of the product are you using? On what operating system?
latest version. OS- Win XP

Please provide any additional information below.

Original issue reported on code.google.com by celebrat...@gmail.com on 31 Oct 2009 at 2:05

GoogleCodeExporter commented 9 years ago
Attaching a screenshot of the error message appearing in Firefox.
thanks.

Original comment by celebrat...@gmail.com on 31 Oct 2009 at 2:26

Attachments:

GoogleCodeExporter commented 9 years ago
I tried it yesterday on another machine and got the same output as you.
But then I tried again today, and it now works.
I'm guessing it was a google 'hiccup'.
Can you try again and see if it works for you too?

Original comment by david.yu...@gmail.com on 2 Nov 2009 at 3:24

GoogleCodeExporter commented 9 years ago
Not a bug.

Original comment by david.yu...@gmail.com on 3 Nov 2009 at 11:06

GoogleCodeExporter commented 9 years ago
Hi David,
I tried it again, but again its the same message. You mentioned that you too 
tried 
it -- was it on a local machine ? i mean thru localhost ? Because that's when i 
face 
this problem. When i try your hosted app. its works great without a hitch. 
Its only when i try it locally that this happens.

Btw, i saw that google requires that the RP should register itself with google 
for 
OAuth to work, but with localhost i haven't done any registration, would that 
be an 
issue ? how do you handle that .. Thnx !

Original comment by celebrat...@gmail.com on 4 Nov 2009 at 10:29

GoogleCodeExporter commented 9 years ago
Yes it was on a local machine (localhost).
You need to register your domain with google to be able to use OAuth.
Goto https://www.google.com/accounts/ManageDomains

Once you've done that, edit src/main/resources/openid_consumer.properties and 
replace
it with your consumer key and consumer secret.

Cheers

Original comment by david.yu...@gmail.com on 4 Nov 2009 at 1:01

GoogleCodeExporter commented 9 years ago
Oh ok.. 

The issue i face during registration is - i cannot register with localhost, 
google 
asks me to copy a certain file in the root folder which it tried to ping back 
and 
fails ( since its local host ) and so the verification step fails and so i 
don't get 
any key / secret values..

How did you handle / test your application during development, without 
deploying it 
over the WWW ? Any suggestions on how this could be addressed would be of great 
help..Thnks!

Original comment by celebrat...@gmail.com on 4 Nov 2009 at 2:30

GoogleCodeExporter commented 9 years ago
You can't register with localhost.  You have to register it with a domain or
subdomain that you have access to.  Say for example yourproject.appspot.com.  
Once
its registered with a domain, use the consumer keys from that domain locally 
for testing.

Cheers

Original comment by david.yu...@gmail.com on 4 Nov 2009 at 4:02

GoogleCodeExporter commented 9 years ago
Thnx David, 

I found another way out - describing below just in case any of the subsequent 
user
faces the same issue.

One of the google engineers suggested that i can use 'anonymous' as my 
consumer_key
and 'anonymous' as my consumer_secret whenever i am testing localhost 
applications.
So in your oauth_consumer.properties file, i placed the following values -
www.google.com.consumer_key = anonymous
www.google.com.consumer_secret = anonymous
all other values being left to default values.

and my oauth functionality worked fine from localhost. I was able to 
authenticate
with google and then later fetch the users contacts after receiving a separate
consent from him. it worked great. IF you can add this to the readme.txt, it 
might
be helpful for new users.

Point to note is that this is not supported by the new Hybrid openid-oauth 
endpoints,
but only works for the non-hybrid openid, oauth endpoints as of today...

Original comment by celebrat...@gmail.com on 7 Nov 2009 at 3:36

GoogleCodeExporter commented 9 years ago
I've updated the demos to use the anonymous keys and updated their READMEs

Thanks!

Original comment by david.yu...@gmail.com on 8 Nov 2009 at 11:53

GoogleCodeExporter commented 9 years ago
Just sharing my experience running the showcase Hybrid sample on localhost:
- Register your domain, let say yourproject.appspot.com
- Edit /etc/hosts, add a new line:
127.0.0.1   yourproject.appspot.com

- unzip the showcase
- Edit oauth_consumer.properties:
www.google.com.consumer_key = your_key
www.google.com.consumer_secret = your_secret

- Build and run:
mvn install
mvn jetty:run

- Using:
Open http://yourproject.appspot.com:8080/hybrid/google/contacts in your browser
And it works as expected.

And http://yourproject.appspot.com:8080/popup_login_hybrid.html also works

* One note: ensure your system time accurate, otherwise Google response a 400 
code with message: Timestamp is too far from current time: 1292937694

Original comment by gwtdevel...@gmail.com on 21 Dec 2010 at 3:14

GoogleCodeExporter commented 9 years ago
Thanks for sharing!  I linked your post from the hybrid wiki.

Original comment by david.yu...@gmail.com on 21 Dec 2010 at 3:25