Develop and test the hybrid Google openid OAuth using openid4java on localhost

I'm trying to implement a hybrid Google openid OAuth protocol to identify my users and access their Google calendar data

Example requests are as follows:

https://www.google.com/accounts/o8/id
?openid.ns=http://specs.openid.net/auth/2.0
&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select
&openid.identity=http://specs.openid.net/auth/2.0/identifier_select
&openid.return_to=http://www.example.com/checkauth
&openid.realm=http://www.example.com
&openid.assoc_handle=ABSmpf6DNMw
&openid.mode=checkid_setup
&openid.ns.oauth=http://specs.openid.net/extensions/oauth/1.0
&openid.oauth.consumer=www.example.com
&openid.oauth.scope=http://docs.google.com/Feeds/+http://spreadsheets.google.com/Feeds/

I am using openid4java I try to focus on this article: library to integrate Google OAuth openid hybrid in java web app

But I had trouble testing my application on localhost

As you can see in the example request above, there are three properties that must be the same:

openid.realm
openid.oauth.consumer
openid.return_to

I have registered some domain names in Google and obtained consumer keys and secrets But when I want to develop and debug my application on localhost (i.e. openid. Return_to)= http://localhost:8080/ And openid realm = http://*. mydomain. COM and openid oauth. consumer = www.mydomain. COM) and provide my key and secret. Openid4java realmverifier rejects such authentication requests

I even tried to provide a fully valid option (my registered domain instead of localhost) – it seemed to work, but the redirection disappeared (I don't want / can't deploy applications in this domain due to lack of Technology)

Can you tell me how to develop such an application on localhost? Are there any tips for testing such applications?

Thanks for your help!

Solution

Try adding / etc / hosts (on Linux) in the development box to point to 127.0 0.1 of your machine your-domain. COM, and then name your application http://your-machine.your-domain.com

(Note: replace your computer name and your domain name with the domain name you registered with Google)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>