c# - WebApi OAuth UseOAuthBearerAuthentication gives "Sequence contains more than one element" error -
I have configured my WebApi OAuth 2.0 via these lines:
app. USEOAuthBearerAuthentication (new OAuthBearerAuthenticationOptions {Provider = New OthebeerAuthiconation Provider (),}); App.UseOAuthBearerTokens (OAuthOptions);
But this gives me the following error on each request:
Message: An error has occurred. Exception Message: More than one element exists in the sequence ExceptionType: System.InvalidOperationException StackTrace: On System.Linq.Enumerable.SingleOrDefault [TSource] (IEnumerable 1 Source) Microsoft.Owin.Security.AuthenticationManager.d__8.MoveNext () --- Finally, the stack trace was detected from the previous location- on the system. COMPLETER SERVICES Task aviator Firenoon success on the system. Timetable COMPLETER SERVICES Talk aviator Notice on handlennessant and debugger system (Task Task). System. Runtime. Completer Services. TaskAwaiter System.Web.Http.HostAuthenticationFilter.d__0.MoveNext () --- On 1.GetResult () --- The end of the stack trace from the previous location where the exception was run on the system. Runtime Compiler Services TalkWalker Trafornon success (work assignment) notification on system at system.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebugger (working function) ..Web.Http.Controllers.AuthenticationFilterResult.d__0.MoveNext () --- end of stac trace k from where last place The exception was thrown-on the system.Runtime Compliant ServicesCakeViator. System on System Rendime. Completer Services Task developer. Handlenousness and Debugger. Task Task on the system. From time to time. COMPLETER SERVICES
My OAuthOptions
is in the Task Wieter 1 System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext ():
OAuthOptions = New OAuthAuthorizationServerOptions {TokenEndpointPath = New PathString ("/ Token"), Provider = New ApplicationOAuthProvider (PublicClientId, UserManagerFactory), AuthorizeEndpointPath = New PathString ("/ Account / External login"), AccessTokenExpireTimeSpan = TimeSpan.FromDays (14) AllowInsecureHttp = True;}; }
If I comment on UseOAuthBearerAuthentication then everything is fine! I have not yet customized the OAuthBearerAuthenticationProvider and I use it directly but why does it give me an error?
It should be a bug!
USEOAuthBearerTokens (OAuthOptions); App USEOAuthAuthorizationServer (OAuthOptions);
instead of
Comments
Post a Comment