NB: Sorry if this post is all over the place, it's been a long day
I am trying to enable oAuth authentication using the same method that is in the spa template in vs 2013 and I am getting an error that I can't seem to full track down.
This is the error that gets returned:
<Message>An error has occurred.</Message>
<ExceptionMessage>Sequence contains more than one element</ExceptionMessage>
at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()
This gets returned when the provider is sending its response.
Using a combination of IActionFilters and DelegatingHandlers, I have determined that this is happening before the IActionFilters are being called.
Is there a way to replace the normal HttpControllerDispatcher so that I can get direct access to the error that is being thrown?
The flow is as follows.
- From the client side, I hit the 'GetExternalLogin' action on the AccountController, and since the user is not authenticated yet, it returns the ChallengeResult.
- The browser gets re-directed to the provider login page (in this case google) and I log in.
- Then the page re-directs to the callback url /api/account/externallogin and that is when I get the above error.
Also, now everytime that I try to hit that route, the error is getting returned. It looks like something is being added to a list, and not cleared out. Restarting the web app allows me to hit the route once successfully again.
The web app created from the template works fine, so I know it is something in my code.
Any insight would be greatly appriciated.