ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
League\OAuth2\Client\Provider Namespace Reference

Get an OAuth2 token from Google. More...

Data Structures

class  Google
 

Variables

 $redirectUri = isset($_SERVER['HTTPS']) ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']
 
 $clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com'
 
 $clientSecret = 'RANDOMCHARS-----lGyjPcRtvP'
 
 $provider
 
if(!isset($_GET['code'])) elseif(empty($_GET['state'])||($_GET['state'] !==$_SESSION['oauth2state'])) else
 

Detailed Description

Get an OAuth2 token from Google.

  • Install this script on your server so that it's accessible as [https/http]://<yourdomain>/<folder>/get_oauth_token.php e.g.: http://localhost/phpmail/get_oauth_token.php
  • Ensure dependencies are installed with 'composer install'
  • Set up an app in your Google developer console
  • Set the script address as the app's redirect URL 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

Variable Documentation

◆ $clientId

League::OAuth2::Client::Provider\$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com'

Definition at line 32 of file get_oauth_token.php.

◆ $clientSecret

League::OAuth2::Client::Provider\$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP'

Definition at line 33 of file get_oauth_token.php.

◆ $provider

League::OAuth2::Client::Provider\$provider
Initial value:
= new Google(
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'redirectUri' => $redirectUri,
'scope' => array('https://mail.google.com/'),
'accessType' => 'offline'
)
)
Create styles array
The data for the language used.

Definition at line 131 of file get_oauth_token.php.

Referenced by ilForumPostsDeleted\__construct(), ilMailAutoCompleteSearch\addProvider(), ilAuthFrontendHTTP\authenticate(), ilAuthFrontend\authenticate(), ilMembershipGUI\checkPermissionBool(), ilStartUpGUI\doApacheAuthentication(), ilStartUpGUI\doCasAuthentication(), ilStartUpGUI\doMigration(), ilStartUpGUI\doMigrationNewAccount(), ilStartUpGUI\doShibbolethAuthentication(), ilObjGroupGUI\executeCommand(), ilClassificationBlockGUI\fillDataSection(), ilClassificationBlockGUI\filterContainer(), ilBadgeHandler\getAvailableTypes(), ilBadgeTypesTableGUI\getItems(), ilAuthProviderFactory\getProviders(), ilForumCronNotification\getRefIdsByObjId(), PHPMailerOAuthGoogle\getToken(), ilBadgeHandler\getTypeInstanceByUniqueId(), ilClassificationBlockGUI\initProviders(), ilAuthFrontend\migrateAccount(), ilStartUpGUI\migrateAccount2(), ilAuthFrontend\migrateAccountNew(), ilObjTermsOfServiceGUI\saveSettings(), ilMailAutoCompleteSearch\search(), ilObjTermsOfServiceGUI\showMissingDocuments(), ilMailMemberSearchGUI\showSelectableUsers(), ilTermsOfServiceAgreementsByLanguageTableDataProviderTest\testAgreementByLanguageProviderCanBeCreatedByFactory(), ilTermsOfServiceAcceptanceHistoryProviderTest\testHistoryProviderCanBeCreatedByFactory(), ilTermsOfServiceAcceptanceHistoryProviderTest\testListCanBeRetrieved(), and ilTermsOfServiceAcceptanceHistoryProviderTest\testRetrievingListThrowsExceptionsWhenInvalidArgumentsArePassed().

◆ $redirectUri

League::OAuth2::Client::Provider\$redirectUri = isset($_SERVER['HTTPS']) ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']

Definition at line 28 of file get_oauth_token.php.

◆ else

if (!isset( $_GET[ 'code'])) elseif (empty( $_GET[ 'state'])||( $_GET[ 'state'] !==$_SESSION[ 'oauth2state'])) League::OAuth2::Client::Provider\else
Initial value:
{
$token = $provider->getAccessToken(
'authorization_code',
'code' => $_GET['code']
)
)
$_GET["client_id"]
Create styles array
The data for the language used.

Definition at line 151 of file get_oauth_token.php.