Category : google-oauth

First of all, i am an absolute beginner in google apis. I followed this tutorial along with many other tutorials on the web -> https://www.webslesson.info/2019/09/how-to-make-login-with-google-account-using-php.html and it is successfully working. But i cant refresh the page after login because i dont have a refresh token. My config.php- <?php session_start(); require_once ‘vendor/autoload.php’; $google_client = new Google_Client(); ..

Read more

i have successfully integrated google api login and logout and both are working fine but after i logged in and try to refresh the webpage .. it shows me the below error- Fatal error: Uncaught GuzzleHttpExceptionClientException: Client error: POST https://oauth2.googleapis.com/token resulted in a 400 Bad Request response: { "error": "invalid_grant", "error_description": "Bad Request" } in ..

Read more

I am having trouble with Oauth2 for the Google API. This is the setup: $client = new Google_Client(); $client->setApplicationName(‘Web client 1′); $client->addScope(Google_Service_Analytics::ANALYTICS_READONLY); $client->setAuthConfig(APPLICATION_PATH.’/Service/oauth2.json’); $client->setIncludeGrantedScopes(true); $client->setRedirectUri(‘https://my.api-1.webmetry.de/analyticsauth’); $client->setAccessType(‘offline’); $client->setPrompt(‘consent’); return $client->createAuthUrl(); With this redirect URI setting in my Google Console: When I open the returned URL I get this error: Error 400: invalid_request Invalid parameter value for ..

Read more

I have a token.json file from oauth authentication to access gmail api, { "access_token":"ya29.a0AfH6SMA0aPlawWwynoN72YoH2iakCdUSdkNvLDYshEuoKLWQ9gRQ7K3R-zGLQlJQFWKO9coLGeHGw31sY4SVKWW5K58UeniCrV5PU7WADrtyZfvzbS1NhpPN3QS5vNwujO0CWdUcf9rmKKbtNnvThiXEYi75", "expires_in":3599, "refresh_token":"1//0gSHWhnIVEFjECgYIARAAGBASNwF-L9IrklaXa9Bk11gDrJGw7X2gaNWmxVKPVKNfS3l1tkh132_QZpMd4BoeM9xxgNPnmKJpH1c", "scope":"https://mail.google.com/ https://www.googleapis.com/auth/gmail.compose", "token_type":"Bearer", "created":1615956208 } Below I have include my code Class Connection extends CI_Controller { public function __construct() { // echo .’contruct’; // die; // parent::__construct(); $this->credentials = "assets/gmail_api/credentials/credentials.json"; $this->client = $this->create_client(); } public function get_client() { return ..

Read more

I try to use the YouTube API, but when I wish to use the LiveBroadcasts.list API. When I use the same JSON key to list my playlist it’s OK… I don’t understand why. $service = new Google_Service_YouTube($client); $broadcastsResponse = $service->liveBroadcasts->listLiveBroadcasts( ‘id,snippet,contentDetails’, array( ‘broadcastType’ => ‘persistent’, ‘mine’ => ‘true’, ) ); The error message is: { ..

Read more