You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Package name and version: google/apiclient": "^2.0
Steps to reproduce
I have created a Custom Endpoint with Wordpress to handle formdata submission that will be written to a Google Sheet. I validate the JSON scheme via justinrainbow/json-schema and then initiate the Google Client.
I import the client secrets for the service account via a PHP array from the WPDB and pass them to the Client.
This code is wrapped in a function. If I have a standard php project with Google autoloaded, the script runs fine and imports the data. However, when I include the function to be called from a registered endpoint on the wp-json api, it errors out:
<br />
<b>Fatal error</b>: Uncaught Exception: Invalid JSON response in
/wordpress/wp-content/plugins/cbnmovies-google-sheets/vendor/google/auth/src/OAuth2.php:553
Stack trace:
#0 /wordpress/wp-content/plugins/cbnmovies-google-sheets/vendor/google/auth/src/OAuth2.php(503):
Google\Auth\OAuth2->parseTokenResponse(Object(GuzzleHttp\Psr7\Response))
#1
/wordpress/wp-content/plugins/cbnmovies-google-sheets/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php(123):
Google\Auth\OAuth2->fetchAuthToken(Object(Google\Auth\HttpHandler\Guzzle6HttpHandler))
#2 /wordpress/wp-content/plugins/cbnmovies-google-sheets/vendor/google/auth/src/FetchAuthTokenCache.php(84):
Google\Auth\Credentials\ServiceAccountCredentials->fetchAuthToken(Object(Google\Auth\HttpHandler\Guzzle6HttpHandler))
#3 /wordpress/wp-content/plugins/cbnmovies-google-sheets/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php(115):
Google\Auth\FetchAuthTokenCache->fetchAuthToken(Object(Google\Auth\HttpHandler\Guzzle6HttpHandler))
#4 /wordpress/wp-content/plugins/cbnmovie in
<b>/wordpress/wp-content/plugins/cbnmovies-google-sheets/vendor/google/auth/src/OAuth2.php</b> on line <b>553</b><br />
If the same code is working outside of WordPress but fails inside, I don't think it's related to this library. We aren't experts on how WordPress's JSON API works, so are probably not best equipped to assist. Have you tried asking this on Stackoverflow or WordPress Stack Exchange?
I'm sorry we can't be of more assistance. Should it happen that the issue is due to this library, please let me know and I'd be more than happy to continue to help!
Environment details
google/apiclient": "^2.0
Steps to reproduce
I have created a Custom Endpoint with Wordpress to handle formdata submission that will be written to a Google Sheet. I validate the JSON scheme via
justinrainbow/json-schema
and then initiate the Google Client.I import the client secrets for the service account via a PHP array from the WPDB and pass them to the Client.
This code is wrapped in a function. If I have a standard php project with Google autoloaded, the script runs fine and imports the data. However, when I include the function to be called from a registered endpoint on the
wp-json
api, it errors out:Code example
The text was updated successfully, but these errors were encountered: