Google OAuth登录在本地工作,在生产服务器上失败 [英] Google OAuth login works locally, fails on production server

查看:95
本文介绍了Google OAuth登录在本地工作,在生产服务器上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在处理的网站,我刚刚发布到beta版(目前与生产版本在同一台服务器上,这是一个个人项目).用户可以选择使用MVC 4 SimpleMembership提供程序通过OAuth登录Google,Facebook或Twitter帐户.

I've got a site that I'm working on that I just published to beta (which is on the same server as production for now -- it's a personal project). Users have the option of logging in using Google, Facebook or Twitter accounts via OAuth using the MVC 4 SimpleMembership provider.

当我从本地计算机上的ASP.NET开发服务器进行操作时,所有功能都可以完美运行.但是,在测试版站点上,OAuthWebSecurity.VerifyAuthentication().IsSuccessful为false(基本上意味着身份验证失败). Twitter和Facebook可以正常工作.

It all works fantastically when I operate it from the ASP.NET Development server on my local machine. However, on the beta site, OAuthWebSecurity.VerifyAuthentication().IsSuccessful is false (basically meaning the authentication failed). Twitter and Facebook work just fine.

代码未更改,因此我认为必须有特定于环境的内容.我检查了OAuthWebSecurity.VerifyAuthentication()的返回值,但没有看到任何信息可以指出为什么它失败或如何解决.

No code has changed, so I'm thinking there must be something specific to the environment. I've inspected the return value of OAuthWebSecurity.VerifyAuthentication() but I don't see any information that would point me towards WHY it failed or what to do to fix it.

关于可能是问题还是如何从Google收到某种错误消息的任何想法?我已经检查了AuthenticationResult对象,但那里没有任何帮助.

Any ideas on what the problem might be or how I can go about getting some kind of an error message from Google? I've inspected the AuthenticationResult object and there's nothing helpful there.

我的原始问题也发布了所有相关代码,但我在Visual Studio中创建了一个全新的全新MVC 4 Internet应用程序,未注释AuthConfig.cs中的行以启用Google登录并将其推向生产.发生了同样的事情,所以我的代码不是问题(因此我从问题中删除了它).

My original question had all of the relevant code posted as well but I created a new brand new MVC 4 Internet Application in Visual Studio, uncommented the lined in AuthConfig.cs to enable Google logins and pushed it to production. The same thing happened, so it's not an issue with my code (therefore I removed it from the question).

推荐答案

因此,在我失去了大部分精力之后,我终于弄清楚服务器上的系统时钟是将来的一天.将其重新设置为正确的时间可解决此问题.

So after losing most of my hair over this one, I finally figured out that my system clock on the server was set a day in the future. Setting it back to the correct time fixed the problem.

这篇关于Google OAuth登录在本地工作,在生产服务器上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆