"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "get_oauth_token.php" between
PHPMailer-6.2.0.tar.gz and PHPMailer-6.3.0.tar.gz

About: PHPMailer is a PHP email transport class that features multiple file attachments, CCs, BCCs, REPLY-TOs, HTML messages, redundant SMTP servers, and word wrap, among others.

get_oauth_token.php  (PHPMailer-6.2.0):get_oauth_token.php  (PHPMailer-6.3.0)
skipping to change at line 41 skipping to change at line 41
*/ */
namespace PHPMailer\PHPMailer; namespace PHPMailer\PHPMailer;
/** /**
* Aliases for League Provider Classes * Aliases for League Provider Classes
* Make sure you have added these to your composer.json and run `composer instal l` * Make sure you have added these to your composer.json and run `composer instal l`
* Plenty to choose from here: * Plenty to choose from here:
* @see http://oauth2-client.thephpleague.com/providers/thirdparty/ * @see http://oauth2-client.thephpleague.com/providers/thirdparty/
*/ */
// @see https://github.com/thephpleague/oauth2-google //@see https://github.com/thephpleague/oauth2-google
use League\OAuth2\Client\Provider\Google; use League\OAuth2\Client\Provider\Google;
// @see https://packagist.org/packages/hayageek/oauth2-yahoo //@see https://packagist.org/packages/hayageek/oauth2-yahoo
use Hayageek\OAuth2\Client\Provider\Yahoo; use Hayageek\OAuth2\Client\Provider\Yahoo;
// @see https://github.com/stevenmaguire/oauth2-microsoft //@see https://github.com/stevenmaguire/oauth2-microsoft
use Stevenmaguire\OAuth2\Client\Provider\Microsoft; use Stevenmaguire\OAuth2\Client\Provider\Microsoft;
if (!isset($_GET['code']) && !isset($_GET['provider'])) { if (!isset($_GET['code']) && !isset($_GET['provider'])) {
?> ?>
<html> <html>
<body>Select Provider:<br/> <body>Select Provider:<br/>
<a href='?provider=Google'>Google</a><br/> <a href='?provider=Google'>Google</a><br/>
<a href='?provider=Yahoo'>Yahoo</a><br/> <a href='?provider=Yahoo'>Yahoo</a><br/>
<a href='?provider=Microsoft'>Microsoft/Outlook/Hotmail/Live/Office365</a><br/> <a href='?provider=Microsoft'>Microsoft/Outlook/Hotmail/Live/Office365</a><br/>
</body> </body>
skipping to change at line 124 skipping to change at line 124
] ]
]; ];
break; break;
} }
if (null === $provider) { if (null === $provider) {
exit('Provider missing'); exit('Provider missing');
} }
if (!isset($_GET['code'])) { if (!isset($_GET['code'])) {
// If we don't have an authorization code then get one //If we don't have an authorization code then get one
$authUrl = $provider->getAuthorizationUrl($options); $authUrl = $provider->getAuthorizationUrl($options);
$_SESSION['oauth2state'] = $provider->getState(); $_SESSION['oauth2state'] = $provider->getState();
header('Location: ' . $authUrl); header('Location: ' . $authUrl);
exit; exit;
// Check given state against previously stored one to mitigate CSRF attack //Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state']) ) { } elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state']) ) {
unset($_SESSION['oauth2state']); unset($_SESSION['oauth2state']);
unset($_SESSION['provider']); unset($_SESSION['provider']);
exit('Invalid state'); exit('Invalid state');
} else { } else {
unset($_SESSION['provider']); unset($_SESSION['provider']);
// Try to get an access token (using the authorization code grant) //Try to get an access token (using the authorization code grant)
$token = $provider->getAccessToken( $token = $provider->getAccessToken(
'authorization_code', 'authorization_code',
[ [
'code' => $_GET['code'] 'code' => $_GET['code']
] ]
); );
// Use this to interact with an API on the users behalf //Use this to interact with an API on the users behalf
// Use this to get a new access token if the old one expires //Use this to get a new access token if the old one expires
echo 'Refresh Token: ', $token->getRefreshToken(); echo 'Refresh Token: ', $token->getRefreshToken();
} }
 End of changes. 7 change blocks. 
8 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)