cakephp Gmail自动登录脚本

eivgtgni  于 2022-11-11  发布在  PHP
关注(0)|答案(3)|浏览(133)

我有Gmail的登录凭据。如果我们通过url或CURL传递用户名和密码,是否可以自动登录Gmail?

wko9yo5t

wko9yo5t1#

如果你右键点击gmail登录页面并查看源代码,你可以找到用户的电子邮件和登录字段的id。
然后,您可以使用这些代码编写一个javascript,自动填充并提交。
这里有一个实现,您可以选中http://techtoggle.com/2009/06/how-to-autologin-into-yahoo-hotmail-lycos-mail/
编辑:它没有使用你提到的语言,但它是一个解决方案都是一样的。此外,虽然链接网址和文章标题没有提到Gmail,但页面上有一个Gmail版本的JavaScript

pbwdgjma

pbwdgjma2#

您可以使用Gmail IMAP界面访问您的所有邮件。Retrieve Your Gmail Emails Using PHP and IMAP-通过代码示例详细介绍了该过程。

cgh8pdjw

cgh8pdjw3#

如果你已经gmail登录去开发者登录和使用谷歌apis
步骤1)使用Google客户端ID,
步骤2)g-signin 2这个div应该调用,
最后使用下面代码,

<html>
<head>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="783587177326-gtl5gpje4riio2ho6qnsfainp4a1mf5o.apps.googleusercontent.com">
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
</body>
</html>
<script>
function onSignIn(googleUser) {
  var profile = googleUser.getBasicProfile();
  console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
  console.log('Name: ' + profile.getName());
  console.log('Image URL: ' + profile.getImageUrl());
  console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
}
</script>

相关问题