3

I want to send a link in email body where user can click on this to use the Login with Google functionality.

i am using this simple link

$client_id ='xxxxxxxxxxxxxxxxxx';
$client_secret = 'xxxxxxxxxxxxxxxxxx';
$redirect_uri ='xxxxxxxxxxxxxxxxxx';

 $google_link='accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri='.$site_url.'&client_id='.$client_id.'&scope=email+profile&access_type=online&approval_prompt=auto'; 

 $html.='<div>

         <a href="'.$google_link.'">Click here</a>

    </div>  
            ';

wp_mail( $email_address,subject, $html, $headers);

But it gives me this error:

The session state () didn't match the state parameter (1843962623)

Question: How to send this link (Login with Google) in email body to user, upon which clicking it redirect the user to my website? And how this state parameter works?

Esar-ul-haq Qasmi
  • 1,052
  • 1
  • 14
  • 30
  • 1
    "But it gives me this error" — What is "it"? The Google webpage? The page on your server you asked it to redirect back to? Something else? Where is the error displayed? As part of the page? On the Developer Tools Console? Somewhere else? – Quentin Sep 07 '17 at 10:37
  • @Quentin Upon clicking on link in email it takes user to Login into Google account then it redirects to the website, there a blank page displays this error. Yes this page is my website's page where it is showing this error. – Esar-ul-haq Qasmi Sep 07 '17 at 10:39

0 Answers0