OAuth2\OAuth2::getClientCredentials PHP Method

getClientCredentials() protected method

According to the spec (draft 20), the client_id can be provided in the Basic Authorization header (recommended) or via GET/POST.
See also: http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-2.4.1
protected getClientCredentials ( array $inputData, array $authHeaders ) : array
$inputData array
$authHeaders array
return array A list containing the client identifier and password, for example
    protected function getClientCredentials(array $inputData, array $authHeaders)
    {
        // Basic Authentication is used
        if (!empty($authHeaders['PHP_AUTH_USER'])) {
            return array($authHeaders['PHP_AUTH_USER'], $authHeaders['PHP_AUTH_PW']);
        } elseif (empty($inputData['client_id'])) {
            // No credentials were specified
            throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_INVALID_CLIENT, 'Client id was not found in the headers or body');
        } else {
            // This method is not recommended, but is supported by specification
            $client_id = $inputData['client_id'];
            $client_secret = isset($inputData['client_secret']) ? $inputData['client_secret'] : null;
            return array($client_id, $client_secret);
        }
    }