我在我的网站中使用DNOA进行身份验证和授权。DNOA OpenID +从本地主机和公共站点到Google的OAuth失败
http://ugi-2.apphb.com/Authentication.htm
当我本地主机上运行我从这段代码得到这个错误
return_to 'http://localhost:8976/Register/Login' not under realm 'http://anonymous/'.
:
private void HandleAuthNullResponse(IAuthenticationResponse authResponse)
{
// Google requires that the realm and consumer key be equal,
// so we constrain the realm to match the realm in the web.config file.
// This does mean that the return_to URL must also fall under the key,
// which means this sample will only work on a public web site
// that is properly registered with Google.
// We will customize the realm to use http or https based on what the
// return_to URL will be (which will be this page).
var consumer = new WebConsumer(GoogleConsumerHelper.ServiceDescription, mConsumerTokenManager);
//Realm realm = "http://localhost:8976/";
Realm realm = System.Web.HttpContext.Current.Request.Url.Scheme + Uri.SchemeDelimiter + consumer.ConsumerKey + "/";
IAuthenticationRequest authReq = GoogleConsumerHelper.RelyingParty.CreateRequest(GoogleConsumerHelper.GoogleOPIdentifier, realm);
错误在某种程度上符合什么是DNOA
评论这很奇怪,因为我看到其他代码适用于本地主机但是结构更少。
我然后转向谷歌的网站,看到:
注册您的Web应用程序
有三个级别的注册:
未注册的:应用程序不被谷歌认可。访问 请求页面会提示您的用户为您的应用程序授予或拒绝访问 显示以黄色突出显示的此警告: “本网站尚未向Google注册。我们建议您只有在您信任的情况下才会继续此过程这个目的地。“
注册:...
增强安全注册:...
注册是可选的,但建议。 ...
我甚至尝试对appHarbor发布,但这并没有帮助(没有日志有尚)
我如何来解决这一问题?
@Andrew Arnott,有什么想法? – 2012-03-16 00:27:33