Code Monkey home page Code Monkey logo

Comments (4)

kamermans avatar kamermans commented on June 1, 2024

Good point, I'm not sure why I didn't abstract that here either. You could use a ClosureTokenPersistence, which overrides that method (along with a few others):

public function __construct(callable $saveToken, callable $restoreToken, callable $deleteToken, callable $hasToken)
{
$this->doSaveToken = $saveToken;
$this->doRestoreToken = $restoreToken;
$this->doDeleteToken = $deleteToken;
$this->doHasToken = $hasToken;
}

Aside from that, to avoid a breaking change I would need some way to override the token constructor, so if it's not overridden you get a RawToken, and if it is, you can provide anything that satisfies the interface.

from guzzle-oauth2-subscriber.

thiakil avatar thiakil commented on June 1, 2024

Perhaps we can take a leaf from Java's book and have a NewTokenSupplier closure field which defaults to RawToken? This would be on the main oauth handler class

from guzzle-oauth2-subscriber.

kamermans avatar kamermans commented on June 1, 2024

Sure, something like that is fine with me - can you put in the PR?

from guzzle-oauth2-subscriber.

kamermans avatar kamermans commented on June 1, 2024

Thanks for the PR, I've tested it and released it in v1.0.8

from guzzle-oauth2-subscriber.

Related Issues (20)

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.