trying to get access spreadsheet on my hosting.
I'm following the guide:
https://github.com/googleapis/google-api-php-client
my php file is not redirecting to google auth page.
my code:
error_reporting(1);
// include your composer dependencies
require_once 'vendor/autoload.php';
$client = new Google_Client();
$client->setAuthConfig('client_secret.json');
$client->addScope(Google_Service_Drive::DRIVE_METADATA_READONLY);
$client->setRedirectUri('http://' . $_SERVER['HTTP_HOST'] . '/oauth2callback.php');
// offline access will give you both an access and refresh token so that
// your app can refresh the access token without user interaction.
$client->setAccessType('offline');
// Using "consent" ensures that your application always receives a refresh token.
// If you are not using offline access, you can omit this.
$client->setApprovalPrompt("consent");
$client->setIncludeGrantedScopes(true); // incremental auth
$auth_url = $client->createAuthUrl();
header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
what is wrong here?
https://developers.google.com/identity/protocols/OAuth2WebServer I have taken the example from here .
Обсуждают сегодня