Title: Invalid Token Format
Last modified: October 26, 2017

---

# Invalid Token Format

 *  Resolved [Caleb](https://wordpress.org/support/users/cidesign/)
 * (@cidesign)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/invalid-token-format/)
 * Hi,
    Your plugin was working for me, but now it is not. I’ve looked through a
   lot of your support tickets and have found no solution that works for me. I’ve
   revoked access and recreated my access token a few times. Deleted plugin and 
   re-installed. Reverted to your plugins older version 1.1.2. None of those have
   worked for me. Initially I was getting the “Incorrect Username and Password” 
   error when I sent a test email. So I revoked access and recreated my access token
   which fixed that error. Now my log is showing the below error:
 *     ```
       2017-10-26 19:44:47 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
       2017-10-26 19:44:47 Connection: opened
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is ""
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "220 smtp.gmail.com ESMTP z9sm9967678pgc.85 - gsmtp"
       2017-10-26 19:44:47 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP z9sm9967678pgc.85 - gsmtp
       2017-10-26 19:44:47 CLIENT -> SERVER: EHLO ritewayshredding.com
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is ""
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-smtp.gmail.com at your service, [192.145.239.41]"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-SIZE 35882577"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-8BITMIME"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-STARTTLS"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME250-STARTTLS"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-ENHANCEDSTATUSCODES"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-PIPELINING"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-CHUNKING"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250 SMTPUTF8"
       2017-10-26 19:44:47 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
       2017-10-26 19:44:47 CLIENT -> SERVER: STARTTLS
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is ""
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "220 2.0.0 Ready to start TLS"
       2017-10-26 19:44:47 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
       2017-10-26 19:44:47 CLIENT -> SERVER: EHLO ritewayshredding.com
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is ""
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-smtp.gmail.com at your service, [192.145.239.41]"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-SIZE 35882577"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-8BITMIME"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-ENHANCEDSTATUSCODES"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-PIPELINING"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250-CHUNKING"
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING"
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "250 SMTPUTF8"
       2017-10-26 19:44:47 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [192.145.239.41]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
       2017-10-26 19:44:47 Auth method requested: XOAUTH2
       2017-10-26 19:44:47 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
       2017-10-26 19:44:47 CLIENT -> SERVER: QUIT
       2017-10-26 19:44:47 SMTP -> get_lines(): $data is ""
       2017-10-26 19:44:47 SMTP -> get_lines(): $str is "221 2.0.0 closing connection z9sm9967678pgc.85 - gsmtp"
       2017-10-26 19:44:47 SERVER -> CLIENT: 221 2.0.0 closing connection z9sm9967678pgc.85 - gsmtp
       2017-10-26 19:44:47 Connection: closed
   
       Fatal error: Uncaught InvalidArgumentException: Invalid token format in /home/ritewa5/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:434 Stack trace: #0 /home/ritewa5/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(138): Google_Client->setAccessToken(Array) #1 /home/ritewa5/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64() #2 /home/ritewa5/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(152): SMTP->authenticate('', '', 'XOAUTH2', '', '', Object(GmailXOAuth2)) #3 /home/ritewa5/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array) #4 /home/ritewa5/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1335): PHPMailer->smtpSend('Date: Thu, 26 O...', 'wefwefwefwefqwe...') #5 /home/ritewa5/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1213): PHPMailer->postSend() #6 /home/ritewa5/public_html/wp in /home/ritewa5/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 434
       ```
   
 * Here is my server info:
 *     ```
       OS: Linux biz199.inmotionhosting.com 2.6.32-673.26.1.lve1.4.20.el6.x86_64 #1 SMP Tue Dec 27 17:42:53 EST 2016 x86_64
       PHP version: 7.0.22
       WordPress version: 4.8.2
       WordPress multisite: No
       openssl: Available
       allow_url_fopen: Enabled
       stream_socket_client: Available
       fsockopen: Available
       cURL: Available
       cURL Version: 7.45.0, OpenSSL/1.0.1e
       ```
   
 * What can I do to get this to work? I appreciate any help you can give me. Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Finvalid-token-format%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  [Jordan S Zoot CPA](https://wordpress.org/support/users/jszesq/)
 * (@jszesq)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/invalid-token-format/#post-9627127)
 * It sounds like we are having the same issue. We are a Google G Suite Partner,
   and I have posted a case on this in the Google Connect for Work community at 
   [Has Anyone Solved API Error Issues For Gmail SMTP WordPress Plug In?](https://www.cloudconnect.goog/message/79317#79317).
 * We are using the same version server that you are. This has become a P1 level
   issue for us.

Viewing 1 replies (of 1 total)

The topic ‘Invalid Token Format’ is closed to new replies.

 * ![](https://ps.w.org/gmail-smtp/assets/icon-128x128.png?rev=2432932)
 * [Gmail SMTP](https://wordpress.org/plugins/gmail-smtp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gmail-smtp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gmail-smtp/)
 * [Active Topics](https://wordpress.org/support/plugin/gmail-smtp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gmail-smtp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gmail-smtp/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Jordan S Zoot CPA](https://wordpress.org/support/users/jszesq/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/invalid-token-format/#post-9627127)
 * Status: resolved