ServiceInterface.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. *
  29. * @return TokenInterface $token
  30. *
  31. * @throws TokenResponseException
  32. */
  33. public function requestAccessToken($code);
  34. }