我已经构建了当前在本地主机上运行的CGI ::应用程序,并使用了2种身份验证方法 -
1.描述 http://www.perlmonks.org/?node_id=622071 通过将用户密码存储在数据库中,并
2.使用LDAP凭据。

我正在寻找一种简单的方法来进行Google身份验证,但还没有找到一种简单的方法。有人可以将我指向正确的方向吗?

我看着
1. authen-googleaccount和
2. Net-Google federatedLogin

但是对于其中的任何一个都没有足够的文档。我从哪说起呢?如果您有一些指针在CGI :: application之外进行此操作,请让我知道

有帮助吗?

解决方案

这是我能找到的最接近的解决方案。我不是安全专家,但我认为网站对它的使用不会使用这种方法。它使用www ::机械化来使用Google电子邮件/密码进行身份验证,然后将安全内容拉出。

http://gregjessup.com/login-to-google-using-perl/

如果$ MECH-> get($ url);返回错误,身份验证失败。

其他提示

这是我用于开发人员Android市场的代码(Market.android.com/publish):

use WWW::Mechanize;
use HTTP::Cookies;

my $url = 'https://www.google.com/accounts/ServiceLogin';
my $username = 'username@gmail.com';                                                          
my $password = "PASSWORD";
my $mech = WWW::Mechanize->new();
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get($url);
$mech->form_number(1);
$mech->field(Email => $username);
$mech->field(Passwd => $password);
$mech->click();
# Go to the next link, now that we are logged in.                                                                                   
$url = 'https://market.android.com/publish/Home';
$mech->get($url);
print $mech->content();

这是链接Prateek发布的小型编辑/清理: http://gregjessup.com/login-to-google-using-perl。我认为应该可以用于大多数需要您登录的Google服务。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top