Comments (10)
It's currently based off of V1, I was planning on refactoring it to V2 in coming days.
An OAuthConfig
class would probably be sufficient. I was thinking along the lines of an enum for different grant types which makes eg. validate()
behave differently.
from saloon.
Hey @dododedodonl I was wondering if this is something you are working on and willing to PR or if you would like me to make a PR based on your branch? You may also want to sync your branch as there were quite a few changes leading up to the launch including making the AccessTokenAuthenticator have a nullable refresh token and expiry.
from saloon.
This has now been released!
from saloon.
@Sammyjo20 thank you for the implementation. I finally had the time to look at it. It works lovely
from saloon.
Hey @dododedodonl
Thank you for offering to PR this, that would be great.
I reckon a separate trait for the other authentication grants.
Would you be able to PR it into v2? I was also thinking about the OAuthConfig
class could also be renamed to AuthorizationCodeOAuthConfig
or something like that, with version two I am still accepting some breaking changes before I release it.
But to answer your questions:
should there be different requests per grant type? if so, should they be moved to different directories in the OAuth2 folder?
If the requests are different then yes, but if you can re-use them by passing in the OAuth2 config type, that could be useful?
the redirect uri is checked, but this is not required for the client_credentials grant
That's okay.
the client_credentials grant does not require a refresh token (altough some implementations do provide it)
should that be removed from \Sammyjo20\Saloon\Interfaces\OAuthAuthenticatorInterface or implemented optionally?
That's a good point. I'm not too sure on what to do with this authenticator...
from saloon.
I am also hoping to release v2 very quickly, so if it's not something that you can PR within the next 7-14 days then maybe I can look at doing some renaming so it can be added without any breaking changes into v2.
from saloon.
I was just thinking about the OAuthConfig
class, and I was thinking, we could just add additional methods to that, and depending on the type of grant you're using - you just use the methods that are relevant to you? That way we don't have to have a "Config" class for each grant type and potentially duplicate methods
from saloon.
Hey @dododedodonl in #164 I have made the refresh token and expiry completely optional, so we can use the AccessTokenAuthenticator for the other flows and you can use $authenticator->isRefreshable()
to check if it has a refresh token :)
I will be releasing Saloon v2 over the next few days so let me know if you need to make any urgent final breaking changes.
from saloon.
I've started refactoring in a branch: https://github.com/dododedodonl/Saloon/tree/feature/oauth2-client-credentials-grant
The main points I came across were mentioned in the issue, and have not found new ones
from saloon.
I have started a PR for this in #177 @dododedodonl @relaypilot please let me know what you think.
from saloon.
Related Issues (20)
- ERROR There are no commands defined in the "saloon" namespace. HOT 1
- Rate Limit Plugin: Issue with 'allow(1)->everySeconds(1)->sleep()' Exceeding One Request per Second
- Inteliphense cannot recognize the merge() method on request HOT 3
- Connector default headers overwrite request body headers
- Remove authentication on a specific request HOT 5
- Some properties are removed from the response body
- Using non-standard HTTP methods HOT 2
- Generating Documentation Files for GPT on ChatGPT HOT 4
- Tests using Fixtures with custom Authenticators record incorrect response HOT 1
- async request with multi connector HOT 1
- Allow partial overriding of fixtures HOT 2
- Asserting a request is sent by closure parameter HOT 1
- Connector object() throws an exception but json returns null|object? HOT 1
- Feature Request: Requests have the ability to return a Colleciton HOT 1
- Connector does not support `defaultBody()`? HOT 3
- Request class cannot accept `$query` property in constructor HOT 3
- Possible to Use Multiple Instances of Same Request in Single Test?
- Override Connector defaultHeaders() in request HOT 5
- Offloading a Listener for SentSaloonRequest events to a queue returns error HOT 3
- Pagination: `currentPage` doesn't align with `page` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from saloon.