Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access token is invalid #172

Open
tomasHegi opened this issue Mar 22, 2017 · 1 comment
Open

Access token is invalid #172

tomasHegi opened this issue Mar 22, 2017 · 1 comment

Comments

@tomasHegi
Copy link

tomasHegi commented Mar 22, 2017

Hi, when trying to connet to spreadsheet and retrieve spreadsheets I am getting following error:
access token is invalid.

$client = $this->getClient();
$token = $client->getAccessToken();
$serviceRequest = new DefaultServiceRequest($token['access_token']);
ServiceRequestFactory::setInstance($serviceRequest);

I don't think, that access token is invalid cause I could connect via Google_Service_Sheets.

Thanks in advance.

@kavishdahekar
Copy link

kavishdahekar commented Mar 27, 2017

Facing the same issue.
While generating the access token, I tried all the three options below :

1. $client->addScope(Google_Service_Drive::DRIVE);
2. $client->addScope("https://www.googleapis.com/auth/spreadsheets");
3. $client->addScope("https://spreadsheets.google.com/feeds");

But still getting the "Access token is invalid" error.

Complete code snippet below:

$google_api_credentials = 'creds.json';
$client = new Google_Client();
$client->setAuthConfig($this->google_api_credentials);
$client->addScope("https://www.googleapis.com/auth/spreadsheets");
$redirect_uri = site_url('gsheet/handleAuthRedirect');
$client->setRedirectUri($redirect_uri);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants