public function testClientSecretAddedIfSetForRefreshTokenRequests() { $testConfig = $this->tokenRequestMinimal; $testConfig['clientSecret'] = 'a_client_secret'; $o = new OAuth2($testConfig); $o->setRefreshToken('a_refresh_token'); $request = $o->generateCredentialsRequest(); $fields = Psr7\parse_query((string) $request->getBody()); $this->assertEquals('a_client_secret', $fields['client_secret']); }
public function testGeneratesRefreshTokenRequests() { $testConfig = $this->tokenRequestMinimal; $o = new OAuth2($testConfig); $o->setRefreshToken('a_refresh_token'); // Generate the request and confirm that it's correct. $req = $o->generateCredentialsRequest(); $this->assertInstanceOf('GuzzleHttp\\Message\\RequestInterface', $req); $this->assertEquals('POST', $req->getMethod()); $fields = $req->getBody()->getFields(); $this->assertEquals('refresh_token', $fields['grant_type']); $this->assertEquals('a_refresh_token', $fields['refresh_token']); }