You are here

public function GoogleAuthManager::getAccessToken in Open Social 8.3

Same name and namespace in other branches
  1. 8.9 modules/custom/social_auth_google/src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::getAccessToken()
  2. 8 modules/custom/social_auth_google/src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::getAccessToken()
  3. 8.2 modules/custom/social_auth_google/src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::getAccessToken()
  4. 8.4 modules/custom/social_auth_google/src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::getAccessToken()
  5. 8.5 modules/custom/social_auth_google/src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::getAccessToken()
  6. 8.6 modules/custom/social_auth_google/src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::getAccessToken()
  7. 8.7 modules/custom/social_auth_google/src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::getAccessToken()
  8. 8.8 modules/custom/social_auth_google/src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::getAccessToken()

Reads user's access token from social network.

Parameters

string $type: Type of action. "login" or "register".

Return value

object User's access token, if it could be read from social network. Null, otherwise.

Overrides AuthManagerInterface::getAccessToken

File

modules/custom/social_auth_google/src/GoogleAuthManager.php, line 61

Class

GoogleAuthManager
Class GoogleAuthManager.

Namespace

Drupal\social_auth_google

Code

public function getAccessToken($type) {
  $redirect_url = $this
    ->getRedirectUrl($type);
  $this->sdk
    ->setRedirectUri($redirect_url);
  return $this->sdk
    ->authenticate(\Drupal::request()
    ->get('code'));
}