You are here

public function TwitterAuthManager::getProfile in Open Social 8

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

Returns object of a user profile.

Return value

mixed Returns the profile.

Overrides AuthManagerInterface::getProfile

3 calls to TwitterAuthManager::getProfile()
TwitterAuthManager::getAccountId in modules/custom/social_auth_twitter/src/TwitterAuthManager.php
Returns an account ID on a social network.
TwitterAuthManager::getProfilePicture in modules/custom/social_auth_twitter/src/TwitterAuthManager.php
Returns URL of a profile picture.
TwitterAuthManager::getUsername in modules/custom/social_auth_twitter/src/TwitterAuthManager.php
Returns user on a social network if it possible.

File

modules/custom/social_auth_twitter/src/TwitterAuthManager.php, line 66

Class

TwitterAuthManager
Manages the authorization process before getting a long lived access token.

Namespace

Drupal\social_auth_twitter

Code

public function getProfile() {
  try {
    $this->profile = $this->sdk
      ->get('account/verify_credentials', [
      'include_email' => 'true',
      'include_entities' => 'false',
      'skip_status' => 'true',
    ]);
    return $this->profile;
  } catch (TwitterOAuthException $e) {
    $this->loggerFactory
      ->get('social_auth_twitter')
      ->error('Could not load Twitter user profile: TwitterOAuthException: @message', [
      '@message' => $e
        ->getMessage(),
    ]);
    return NULL;
  }
  return FALSE;
}