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