servicestack,self-hosting,Oauth,servicestack,Self Hosting" /> servicestack,self-hosting,Oauth,servicestack,Self Hosting" />

servicestack oauth2 google身份验证不适用于自托管站点

servicestack oauth2 google身份验证不适用于自托管站点,oauth,servicestack,self-hosting,Oauth,servicestack,Self Hosting,我一直在尝试将Google的OAuth2提供程序添加到基于ServiceStack构建的概念验证应用程序中,但是在尝试启动登录时,我不断收到以下错误 This method requires a current HttpContext. Alternatively, use an overload of this method that allows you to pass in information without an HttpContext`enter code here` [Auth

我一直在尝试将Google的OAuth2提供程序添加到基于ServiceStack构建的概念验证应用程序中,但是在尝试启动登录时,我不断收到以下错误

This method requires a current HttpContext. Alternatively, use an overload of this method that allows you to pass in information without an HttpContext`enter code here`

[Auth: 11/21/2013 10:29:25 PM]: [REQUEST: {provider:googleoauth}] System.InvalidOperationException: This method requires a current HttpContext. Alternatively, use an overload of this method that allows you to pass in information without an HttpContext. at DotNetOpenAuth.Requires.ValidState(Boolean condition, String message) at DotNetOpenAuth.Messaging.Channel.GetRequestFromContext() at DotNetOpenAuth.OAuth2.WebServerClient.ProcessUserAuthorization(HttpRequestBase request) at ServiceStack.Authentication.OAuth2.OAuth2Provider.Authenticate(IServiceBase authService, IAuthSession session, Auth request) at ServiceStack.ServiceInterface.Auth.AuthService.Authenticate(Auth request, String provider, IAuthSession session, IAuthProvider oAuthConfig) at ServiceStack.ServiceInterface.Auth.AuthService.Post(Auth request) at ServiceStack.ServiceInterface.Auth.AuthService.Get(Auth request) at lambda_method(Closure , Object , Object ) at ServiceStack.ServiceHost.ServiceRunner`1.Execute(IRequestContext requestContext, Object instance, TRequest request)
我还下载了演示应用SocialBootstrapApi,并向其中添加了Google Oauth2提供商,使其能够正常工作。我已经将配置从web.config复制到自托管项目的app.config文件中,但它仍然不起作用

任何帮助都会很好

感谢您的帮助。

是一个ASP.NET网络主机,显示在单个应用程序中工作

请注意,OAuth2提供商使用中指定的附加配置,该配置要求您注册自己的应用程序,以获取应用程序的用户密钥和密码。出于测试目的,您可以使用Web.config中已经嵌入的ServiceStack测试键


提供了URL,您可以在其中为每个提供商注册应用程序。

我将此标记为正确的…因为技术上是正确的。但是,我仍然无法让oauth2在使用servicestack的自托管应用程序中工作。当您将其与web托管应用程序一起使用时,它会完美工作。如果你知道有任何项目已经做到了这一点,你可以把它们传下去。能够将servicestack作为一个独立的应用程序托管是我整体架构的关键。@Dan Yeah我发现DotNetOpenAuth在自托管HttpListener中托管时无法正常工作,因此任何需要DNOA才能工作的东西,例如支持的OAuth2此时仅限于ASP.NET主机。如果您希望进一步研究此问题,请添加。