'Auto Login for Gmail account via a redirected URL without having gmail login credentials

My task is to make any user login into Gmail without knowing the login credentials.

I have made a page called test.php where i will pass the username & password for gmail account and also redirect it to Gmail login URL.

After researching, i got this URL..

https://accounts.google.com/ServiceLoginAuth?continue=http://mail.google.com/gmail&service=mail&[email protected]&Passwd=PASSWORD&null=Sign+in

Here my email gets auto-populated in the Gmail login form but not pasword.

Can anyone...resolve it.. or tell me some other way to achieve it.. Thanks..



Solution 1:[1]

$url = 'https://www.google.com/accounts/ClientLogin';
$params = "accountType=GOOGLE&Email=".$email."&Passwd=".$password."&service=cp&source=moneymagpie"; [$email = Your from email, $password = Your form password]

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);

$response = curl_exec($ch);

Try out with this code.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 som