3

I'm trying to use google accounts/login for my website(it is local at the moment/localhost) but I keep getting this error. I uncommented OAuthWebSecurity.RegisterGoogleClient(); in the AuthConfig class.

Sequence contains no elements

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Sequence contains no elements

Source Error:

Line 362: public override void ExecuteResult(ControllerContext context)
Line 363: {
Line 364:     OAuthWebSecurity.RequestAuthentication(Provider, ReturnUrl);
Line 365: }

Source File: c:\Users\JoeyM\Documents\Visual Studio 2013\Projects\OdeToFood\OdeToFood\Controllers\AccountController.cs Line: 364

Stack Trace:

[InvalidOperationException: Sequence contains no elements]
System.Linq.Enumerable.First(IEnumerable`1 source) +269
       DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.CreateRequest(Identifier       userSuppliedIdentifier, Realm realm, Uri returnToUrl) +112

[ProtocolException: No OpenID endpoint found.]
   DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.CreateRequest(Identifier     userSuppliedIdentifier, Realm realm, Uri returnToUrl) +154
   DotNetOpenAuth.AspNet.Clients.OpenIdClient.RequestAuthentication(HttpContextBase context, Uri returnUrl) +100
   DotNetOpenAuth.AspNet.OpenAuthSecurityManager.RequestAuthentication(String returnUrl) +377
   Microsoft.Web.WebPages.OAuth.OAuthWebSecurity.RequestAuthenticationCore(HttpContextBase context, String provider, String returnUrl) +57
   Microsoft.Web.WebPages.OAuth.OAuthWebSecurity.RequestAuthentication(String provider, String returnUrl) +92
   OdeToFood.Controllers.ExternalLoginResult.ExecuteResult(ControllerContext context) in c:\Users\JoeyM\Documents\Visual Studio 2013\Projects\OdeToFood\OdeToFood\Controllers\AccountController.cs:364
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +23
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +175
   System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +89
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +102
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +43
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9651116
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Tieson T.
  • 20,774
  • 6
  • 77
  • 92
FiF4M33sTeR
  • 269
  • 1
  • 4
  • 13
  • I think Google changed their API and this will not work for newer domains anyway (example: https://stackoverflow.com/questions/23780039/mvc-google-login-openid-auth-request-contains-an-unregistered-domain) - not sure if it is exactly related but maybe it's of general interest – Random Dev Jul 20 '15 at 06:39

0 Answers0