Comments (2)
You'll need to use the latest version of the client library on trunk
http://code.google.com/p/google-api-php-client/source/checkout.
New auto approval functionality:
$client->setApprovalPrompt('auto');
New 'online' access type:
$client->setAccessType('online');
As for the redirect_uri_mismatch error, you need register your redirect uri
within the google api console.
Example using auto approval:
$client = new apiClient();
$client->setApplicationName("Google+ PHP Starter Application");
$client->setApprovalPrompt('auto');
// Visit https://code.google.com/apis/console?api=plus to generate your
// client id, client secret, and to register your redirect uri.
$client->setClientId('insert_your_oauth2_client_id');
$client->setClientSecret('insert_your_oauth2_client_secret');
$client->setRedirectUri('insert_your_oauth2_redirect_uri');
$client->setDeveloperKey('insert_your_developer_key');
$plus = new apiPlusService($client);
if (isset($_GET['code'])) {
$client->authenticate();
$_SESSION['token'] = $client->getAccessToken();
header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
}
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
if ($client->getAccessToken()) {
$me = $plus->people->get('me');
print "Your Profile: <pre>" . print_r($me, true) . "</pre>";
$_SESSION['token'] = $client->getAccessToken();
} else {
$authUrl = $client->createAuthUrl();
print "<a class='login' href='$authUrl'>Connect Me!</a>";
}
Original comment by [email protected]
on 12 Dec 2011 at 5:03
from google-api-php-client.
Original comment by [email protected]
on 14 Dec 2011 at 10:17
- Changed state: Fixed
from google-api-php-client.
Related Issues (20)
- $file->getWebContentLink() is mostly empty HOT 3
- Contacts return blank info HOT 2
- Adding DFA Reporting API library and examples to Google APIs PHP Client HOT 2
- Google+ and googleCalendar API : Error “Cannot redeclare class Google_Acl” HOT 1
- Unable to Auth to Google_DirectoryService HOT 2
- Error uploading file with service account HOT 2
- Datastore and sorting batch lookup query HOT 2
- :redirect_uri_mismatch HOT 2
- [Feature] Use namespaces HOT 3
- Please Provide youtube live streaming api samples to integrate in our website
- Patch for /trunk/examples/calendar/simple.php
- Could you please share an example how to import contact? HOT 3
- google-api-php-client (Videos: insert)
- Patch for /trunk/examples/batch.php
- Patch for /trunk/examples/userinfo/index.php
- ..
- Will, this error is the reason?
- trying to upload large files on drive
- Not able login by Google plus my wordpress site
- Not able to login by google plus wordpress site
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-api-php-client.