You are here

OauthInterface.php in Media: Acquia DAM 8

File

src/OauthInterface.php
View source
<?php

namespace Drupal\media_acquiadam;


/**
 * OAuth Interface.
 */
interface OauthInterface {

  /**
   * Get the URL to redirect a user to to start the oauth process.
   *
   * @return string
   *   The URL to redirect to.
   */
  public function getAuthLink();

  /**
   * Validate that the state token in an auth request is valid.
   *
   * @param string $token
   *   The CSRF token from the auth request.
   *
   * @return bool
   *   TRUE if the state is valid. FALSE otherwise.
   */
  public function authRequestStateIsValid($token);

  /**
   * Get a token for API access + the number of seconds till expiration.
   *
   * @param string $auth_code
   *   The authorization token from oauth.
   *
   * @return array
   *   Returns an array with three keys:
   *     - access_token: The access token used for API authorization.
   *     - expire_time: The unix timestamp when the access token expires.
   *     - refresh_token: The refresh token used for API authorization.
   */
  public function getAccessToken($auth_code);

  /**
   * Refresh an existing access token.
   *
   * @param string $refresh_token
   *   The refresh token.
   *
   * @return array
   *   Returns an array with three keys:
   *     - access_token: The access token used for API authorization.
   *     - expire_time: The unix timestamp when the access token expires.
   *     - refresh_token: The refresh token used for API authorization.
   */
  public function refreshAccess($refresh_token);

}

Interfaces

Namesort descending Description
OauthInterface OAuth Interface.