ServiceInterface.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace OAuth\OAuth2\Service;
  3. use OAuth\Common\Consumer\CredentialsInterface;
  4. use OAuth\Common\Storage\TokenStorageInterface;
  5. use OAuth\Common\Token\TokenInterface;
  6. use OAuth\Common\Http\Client\ClientInterface;
  7. use OAuth\Common\Http\Exception\TokenResponseException;
  8. use OAuth\Common\Service\ServiceInterface as BaseServiceInterface;
  9. use OAuth\Common\Http\Uri\UriInterface;
  10. /**
  11. * Defines the common methods across OAuth 2 services.
  12. */
  13. interface ServiceInterface extends BaseServiceInterface
  14. {
  15. /**
  16. * Authorization methods for various services
  17. */
  18. const AUTHORIZATION_METHOD_HEADER_OAUTH = 0;
  19. const AUTHORIZATION_METHOD_HEADER_BEARER = 1;
  20. const AUTHORIZATION_METHOD_QUERY_STRING = 2;
  21. const AUTHORIZATION_METHOD_QUERY_STRING_V2 = 3;
  22. const AUTHORIZATION_METHOD_QUERY_STRING_V3 = 4;
  23. const AUTHORIZATION_METHOD_QUERY_STRING_V4 = 5;
  24. /**
  25. * Retrieves and stores/returns the OAuth2 access token after a successful authorization.
  26. *
  27. * @param string $code The access code from the callback.
  28. * @param string $state
  29. *
  30. * @return TokenInterface $token
  31. *
  32. * @throws TokenResponseException
  33. */
  34. public function requestAccessToken($code, $state = null);
  35. }