Skip to content

Commit

Permalink
Avoid IDE warnings in a mixed PHP version project
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Sep 22, 2015
1 parent b3677b9 commit d6d7a8d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions get_oauth_token.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* If no refresh token is obtained when running this file, revoke access to your app
* using link: https://accounts.google.com/b/0/IssuedAuthSubTokens and run the script again.
* This script requires PHP 5.4 or later
* PHP Version 5.4
*/

require 'vendor/autoload.php';
Expand All @@ -19,19 +20,20 @@
//If this automatic URL doesn't work, set it yourself manually
$redirectUri = isset($_SERVER['HTTPS']) ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
//$redirectUri = 'http://localhost/phpmailer/get_oauth_token.php';

//These details obtained are by setting up app in Google developer console.
$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';

//All details obtained by setting up app in Google developer console.
//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
$provider = new League\OAuth2\Client\Provider\Google (
[
$provider = new League\OAuth2\Client\Provider\Google(
array(
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'redirectUri' => $redirectUri,
'scopes' => ['https://mail.google.com/'],
'scopes' => array('https://mail.google.com/'),
'accessType' => 'offline'
]
)
);

if (!isset($_GET['code'])) {
Expand All @@ -49,9 +51,9 @@
// Try to get an access token (using the authorization code grant)
$token = $provider->getAccessToken(
'authorization_code',
[
array(
'code' => $_GET['code']
]
)
);
// Use this to interact with an API on the users behalf
// echo $token->accessToken.'<br>';
Expand Down

0 comments on commit d6d7a8d

Please sign in to comment.