我在我的網站中使用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