Coder Social home page Coder Social logo

guzzle-oauth2-plugin's People

Contributors

bojanz avatar fullpipe avatar marfillaster avatar omissis avatar pjcdawkins avatar steffkes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

guzzle-oauth2-plugin's Issues

Password Credentials - Client ID

Hi Guys,

I am using the PasswordCredentials grant type and I think I noticed a problem.

On line 19 of the PasswordCredentials GrantType it merges the parents required parameters with the username,password.

The parents getRequired returns 'client_id'.

This means that the PasswordCredentials required parameters become ['client_id', 'username', 'password']. I don't however think this is correct as looking at the RFC it states that only grant_type, username and password are the required parameters.

I have only started using the plugin so I might be doing things wrong but I wanted to flag it anyway.

Thanks,
Stephen

The getConfig Method from the Guzzle ClientInterface will be removed in 8

Hi!
Do you already have some migrations plans for the getConfig method which will be removed in Guzzle 8?
It's already marked as deprecated and as far as I have followed the messages from the guzzle team there won't be an alternative to access the "real" config of the client..
Thanks &
Regards Alex

AuthorizationCode "redirect_uri" missing

Hi,
While doing some test whit AutorizationCode, I've notice that the "redirect_uri" is missing, so I added it in AuthorizationCode.php, as follows:

class AuthorizationCode implements GrantTypeInterface
{
    /** @var ClientInterface The token endpoint client */
    protected $client;

    /** @var Collection Configuration settings */
    protected $config;

    public function __construct(ClientInterface $client, $config)
    {
        $this->client = $client;
        $this->config = Collection::fromConfig($config, array(
            'client_secret' => '',
            'scope' => '',
            'redirect_uri' => '',
        ), array(
            'client_id', 'code', 'redirect_uri'
        ));
    }

    /**
     * {@inheritdoc}
     */
    public function getTokenData()
    {
        $postBody = array(
            'grant_type' => 'authorization_code',
            'code' => $this->config['code'],
            'redirect_uri' => $this->config['redirect_uri'],
        );
        if ($this->config['scope']) {
            $postBody['scope'] = $this->config['scope'];
        }
        $request = $this->client->post(null, array(), $postBody);
        $request->setAuth($this->config['client_id'], $this->config['client_secret']);
        $response = $request->send();
        $data = $response->json();

        $requiredData = array_flip(array('access_token', 'expires_in', 'refresh_token'));
        return array_intersect_key($data, $requiredData);
    }
}

I'm trying to use the AuthorizationCode flow, but I can't figure out how. Could you improve the documentation by explain this flow as well?

Thank you

Get error: Invalid version string "^2.0"

Trying to use this plugin. My composer.json file is:
{
"require": {
"commerceguys/guzzle-oauth2-plugin": "~2.0"
}
}

when I do a "drush composer install" I get the error:

[RuntimeException]
Could not load package commerceguys/guzzle-oauth2-plugin in http://packagist.org: [UnexpectedValueException] Could not parse version constraint ^2.0: Invalid version string "^2.0"

My composer version is:
Composer version 1.0-dev (b2173d28fc8b56236eddc8aa10dcda61471633ec) 2015-06-16 10:43:55

The issue seems to be that guzzle-oauth2-plugin has a dependency:
"firebase/php-jwt": "^2.0"

and it doesn't seem to like the ^ character. Any ideas?

Guzzle 6

Please make this library compatible with Guzzle version 6

cache integration for token persistence

Hi CommerceGuys,

I've forked your excellent work to add Cache integration ( Doctrine cache ) .
It add a dependency on doctrine/cache in composer but doesn't introduce any bc break.
Is it something that your interested in, if yes i can send a PR.

Regards

Xavier

Access Token caching

Hi guys, is there a way to cache the access token, so that It does not need to get it on every request?

Config is missing refresh_token

Hi,

When I try using the example on the front page I am getting the following error:

 Config is missing the following keys: refresh_token

PasswordCredentials expecting ClientInterface

Hi, I'm trying to run your plugin but an error stops me. Please help ;)

My code is:
$url = 'http://httpbin.org/get';
$oauth2Client = new Client(['base_url' => $url]);
$config = array(
'username' => 'myusername',
'password' => 'mypassword',
'client_id' => 'myclient',
'client_secret' => 'mysecret',
'scope' => 'administration', // Optional.
);

$grantType = new PasswordCredentials($oauth2Client, $config);

ERROR:
Catchable Fatal Error: Argument 1 passed to CommerceGuys\Guzzle\Plugin\Oauth2\GrantType\PasswordCredentials::__construct() must be an instance of Guzzle\Http\ClientInterface, instance of GuzzleHttp\Client given

composer.json requires:
"guzzlehttp/guzzle": "*",
"guzzlehttp/oauth-subscriber": "dev-master",
"commerceguys/guzzle-oauth2-plugin": "dev-master"

firebase/php-jwt dependency (2.2.0) breaks

FYI:

firebase/php-jwt dependency is updated to version 2.2.0.
After a composer update deserialization no longer works, if I lock the firebase/php-jwt dependency to 2.1.0 all works as expected.

I will try to look for the issue myself.

Method that gets/creates access_token? ClientCredentials or Oauth2Subscriber

Hi,

Just want to find out which method would call /oauth/v2/token to get access_token? The reason I'm asking because I want to avoid calling /oauth/v2/token per request otherwise application would be slow. My plan is to keep it in cache (memcached) for about 3000sec.

Thanks

class Testing
{
    private function getToken(Client $client)
    {
        // ....
        $token = $this->getToken($client);
        $subscriber = $this->getSubscriber($token);
        // ....
    }

    private function getToken(Client $client)
    {
        $config = [
            'client_id' => '123456',
            'client_secret' => '12345qwerasdf',
            'token_url' => '/oauth/v2/token'
        ];

        return new ClientCredentials($client, $config);
    }

    private function getSubscriber($token)
    {
        return new Oauth2Subscriber($token);
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.