Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6941103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:50:33+00:00 2026-05-27T12:50:33+00:00

I got a problem on google authenticate, it worked for a month but since

  • 0

I got a problem on google authenticate, it worked for a month but since a few days I got this error :

Fatal error: Uncaught exception 'apiAuthException' with message 
'Invalid token format' in /home/project/html/google/auth/apiOAuth2.php:127 Stack trace:
#0 /home/project/html/google/auth/apiOAuth2.php(89): apiOAuth2->setAccessToken('{? "access_tok...')
#1 /home/project/html/google/apiClient.php(132): apiOAuth2->authenticate(Array)
#2 /home/project/html/hk/connects/google.php(22): apiClient->authenticate()
#3 {main} thrown in /home/project/html/google/auth/apiOAuth2.php on line 127

In apiOAuth2.php I have the code :

$accessToken = json_decode($accessToken, true);
if (! isset($accessToken['access_token']) || ! isset($accessToken['expires_in']) || ! isset($accessToken['refresh_token'])) {
  throw new apiAuthException("Invalid token format");
}

I noticed that google doesn’t send me the $accessToken[‘refresh_token’].
It doesn’t seem to come from google cause I did a correct connexion on http://stackoverflow.com

Maybe it’s cause of my code :

session_start();

$client = new apiClient();
$plus = new apiPlusService($client);

if (!isset($_GET['code'])) {
  header('Location: '.$client->createAuthUrl()); // Calls the same page
} else {
  $client->authenticate(); // Fails at this level
}

EDIT:

I figured a way to do it, like I don’t know what is refresh_token made for I added this line :

if (!isset($accessToken['refresh_token'])) $accessToken['refresh_token'] = 12345678910;

It works for the moment…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:50:33+00:00Added an answer on May 27, 2026 at 12:50 pm

    There is a new explicit parameter called “access_type” required by the google authentication api to obtain a valid refresh token.
    With this parameter you declare that you need offline access to the account and the api provides you a refresh token.

    Download the latest google PHP SDK that automatically handles the new required parameter

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know about non-breaking spaces but I've got the opposite problem and Google doesn't
I've got a problem with textarea's in Google Chrome. I'm using classic ASP, but
This code works fine in IE8/7 and Firefox... But in Google Chrome i got
I've come this far without asking for help, but I've got a problem that
I got a problem like this (this is html/css menu): Eshop | Another eshop
I got a problem with this linq query: from PersistedFileInfo fi in m_Database from
I got a problem with loading the google maps api. I got my own
Reading about how Google solves the translation problem got me thinking. Would it be
I'm switching from v2 to v3 google maps api and got a problem with
I got simple problem - in my eclipse i turned off this helpfull ballons

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.