1<?php
2
3namespace OAuth\OAuth2\Service;
4
5use OAuth\Common\Service\ServiceInterface as BaseServiceInterface;
6use OAuth\Common\Token\TokenInterface;
7
8/**
9 * Defines the common methods across OAuth 2 services.
10 */
11interface ServiceInterface extends BaseServiceInterface
12{
13    /**
14     * Authorization methods for various services.
15     */
16    const AUTHORIZATION_METHOD_HEADER_OAUTH = 0;
17    const AUTHORIZATION_METHOD_HEADER_BEARER = 1;
18    const AUTHORIZATION_METHOD_QUERY_STRING = 2;
19    const AUTHORIZATION_METHOD_QUERY_STRING_V2 = 3;
20    const AUTHORIZATION_METHOD_QUERY_STRING_V3 = 4;
21    const AUTHORIZATION_METHOD_QUERY_STRING_V4 = 5;
22    const AUTHORIZATION_METHOD_HEADER_TOKEN = 6;
23
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    public function requestAccessToken($code, $state = null);
33}
34