Cela me conduit mentale. J'ai une application Web et un compte Google associé. Je souhaite que l'application Web utilise ce lecteur Google et ce lecteur Google UNIQUEMENT ... DE MANIÈRE PERMANENTE. J'utilise google/apiclient:^2.0 J'ai configuré un ID client OAuth 2.0 et téléchargé le fichier JSON.PHP et Google Drive frustration d'authentification
J'ai ceci:
$this->client = new \Google_Client();
$this->client->setClientId('blahblahblah.apps.googleusercontent.com');
$this->client->setAuthConfig(base_path() . '/resources/assets/client_secret.json');
$this->client->setApplicationName('My Web App');
$this->client->setRedirectUri('somewhere');
$this->client->setScopes('https://www.googleapis.com/auth/drive');
return $this->client;
Maintenant, quand je lance ...
$authUrl = $this->client->createAuthUrl();
echo '<a href="'.$authUrl.'">Go</a>';
Et authentifie je reçois un code ...
Maintenant, ma question est ... ce est-ce que je fais avec ce code?
J'ai essayé ... $this->client->authenticate('code here');
et aussi $accessToken = $client->fetchAccessTokenWithAuthCode('code here);
Je continue de recevoir soit dailyLimitExceededUnreg
ou Invalid token format
Je suis vraiment confus et frustré avec l'API d'authentification Google et les documents semblent sortir de rendez-vous amoureux.
Tout conseil dans la bonne direction serait incroyable.
Merci
consultez cette adresse: https: //developers.google.com/api-client-bibliothèque/php/auth/application-web – madalinivascu
voir https://stackoverflow.com/questions/19766912/how-do-i-authorise-an-app-web-or-installed-without-user -intervention-canonique – pinoyyid