Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /** * Authentication adapter for Asana OAuth2. */ final class PhutilAsanaAuthAdap..

Decoded Output download

<?php

/**
 * Authentication adapter for Asana OAuth2.
 */
final class PhutilAsanaAuthAdapter extends PhutilOAuthAuthAdapter {

  public function getAdapterType() {
    return 'asana';
  }

  public function getAdapterDomain() {
    return 'asana.com';
  }

  public function getAccountID() {
    // See T13453. The Asana API has changed to string IDs and now returns a
    // "gid" field (previously, it returned an "id" field).
    return $this->getOAuthAccountData('gid');
  }

  public function getAccountEmail() {
    return $this->getOAuthAccountData('email');
  }

  public function getAccountName() {
    return null;
  }

  public function getAccountImageURI() {
    $photo = $this->getOAuthAccountData('photo', array());
    if (is_array($photo)) {
      return idx($photo, 'image_128x128');
    } else {
      return null;
    }
  }

  public function getAccountURI() {
    return null;
  }

  public function getAccountRealName() {
    return $this->getOAuthAccountData('name');
  }

  protected function getAuthenticateBaseURI() {
    return 'https://app.asana.com/-/oauth_authorize';
  }

  protected function getTokenBaseURI() {
    return 'https://app.asana.com/-/oauth_token';
  }

  public function getScope() {
    return null;
  }

  public function getExtraAuthenticateParameters() {
    return array(
      'response_type' => 'code',
    );
  }

  public function getExtraTokenParameters() {
    return array(
      'grant_type' => 'authorization_code',
    );
  }

  public function getExtraRefreshParameters() {
    return array(
      'grant_type' => 'refresh_token',
    );
  }

  public function supportsTokenRefresh() {
    return true;
  }

  protected function loadOAuthAccountData() {
    return id(new PhutilAsanaFuture())
      ->setAccessToken($this->getAccessToken())
      ->setRawAsanaQuery('users/me')
      ->resolve();
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

/**
 * Authentication adapter for Asana OAuth2.
 */
final class PhutilAsanaAuthAdapter extends PhutilOAuthAuthAdapter {

  public function getAdapterType() {
    return 'asana';
  }

  public function getAdapterDomain() {
    return 'asana.com';
  }

  public function getAccountID() {
    // See T13453. The Asana API has changed to string IDs and now returns a
    // "gid" field (previously, it returned an "id" field).
    return $this->getOAuthAccountData('gid');
  }

  public function getAccountEmail() {
    return $this->getOAuthAccountData('email');
  }

  public function getAccountName() {
    return null;
  }

  public function getAccountImageURI() {
    $photo = $this->getOAuthAccountData('photo', array());
    if (is_array($photo)) {
      return idx($photo, 'image_128x128');
    } else {
      return null;
    }
  }

  public function getAccountURI() {
    return null;
  }

  public function getAccountRealName() {
    return $this->getOAuthAccountData('name');
  }

  protected function getAuthenticateBaseURI() {
    return 'https://app.asana.com/-/oauth_authorize';
  }

  protected function getTokenBaseURI() {
    return 'https://app.asana.com/-/oauth_token';
  }

  public function getScope() {
    return null;
  }

  public function getExtraAuthenticateParameters() {
    return array(
      'response_type' => 'code',
    );
  }

  public function getExtraTokenParameters() {
    return array(
      'grant_type' => 'authorization_code',
    );
  }

  public function getExtraRefreshParameters() {
    return array(
      'grant_type' => 'refresh_token',
    );
  }

  public function supportsTokenRefresh() {
    return true;
  }

  protected function loadOAuthAccountData() {
    return id(new PhutilAsanaFuture())
      ->setAccessToken($this->getAccessToken())
      ->setRawAsanaQuery('users/me')
      ->resolve();
  }

}

Function Calls

None

Variables

None

Stats

MD5 0cab6e3be06b4b417207a07c77f3bfd8
Eval Count 0
Decode Time 93 ms