WebApi OAuth UseOAuthBearerAuthentication gives “Sequence contains more than one element” error
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I configured my WebApi OAuth 2.0 by these lines: app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions { Provider = new OAuthBearerAuthenticationProvider(), }); app.UseOAuthBearerTokens(OAuthOptions); But it gives me the following error at each request : Message : An error has occurred. ExceptionMessage : Sequence contains more than one element ExceptionType : System.InvalidOperationException StackTrace : at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source) at Microsoft.Owin.Security.AuthenticationManager