client_id = $client_id; $this->client_secret = $client_secret; } /** * Authenticate the passed in request with the provided client credentials. * * Client authentication uses HTTP basic authentication with the client id * as the username and the client secret as the password. * * @param \Psr\Http\Message\RequestInterface $request request to authenticate * @return \Psr\Http\Message\RequestInterface authenticated request */ public function authenticate(\Psr\Http\Message\RequestInterface $request): \Psr\Http\Message\RequestInterface { return $request->withHeader('Authorization', 'Basic '.base64_encode($this->client_id.':'.$this->client_secret)); } }