-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why only GET and POST methods allowed? #101
Comments
You are right, when a client makes API calls, it can use the methods you listed and not only GET and POST. The details of those requests are available in the RFC6749 section 4. The client class you mentioned is a client from the authorization server point of view, not from the resource server one. No DELETE, PUT or PACTH requests are expected here. |
I'm a bit confused as to why authorization server would need a client. In my numerous implementation of OAuth only the resource servers would use client. User tries to access resource --> redirect to Oauth Server --> User authenticates --> redirect back to resource server with code --> resource server POST code using the client to auth server. Could you explain scenario when the auth server would need a POST?
Based on that I assumed it was intended for resource clients which as I understand are the clients. |
In the OAuth2 context, each client must be register and is managed by the authorization server (see RFC6749 section 2). To access on/modify/delete protected resources, the client must get an access token. This access token is delivered by the authorization server using flows listed in the same RFC. Unless new flows are created, interactions between the client and the authorization server are done through HTTP requests using GET and POST methods only.
The GET and POST methods are used in almost all authorization flows (see https://tools.ietf.org/html/rfc6749#section-4). The Implicit Grant Type uses only the GET method. See for example https://tools.ietf.org/html/rfc6749#section-4.1.3
When the access token is issued, it is consumed by the client on the resource server. The HTTP methods used by the client to interact with the resource server may be GET, POST, DELETE, PUT... It only depends on the resource server. |
Oh, this client class is meant for just getting tokens from the auth server, not for accessing the resources. But if you were to add PUT, DELETE, and PATCH then it could be reused for accessing resources as well. Are you sure you don't want me to submit a PR for that? |
Is there a particular reason why
makeRequest()
ofOAuth2Client
only allows GET and POST HTTP methods?A typical REST API involves PUT, PATCH, and DELETE which are impossible to use with the client at this time.
In the code i see a comment // Method override as we always do a POST. but not quite sure why is it that "we ALWAYS do a POST".
In our current project we will be overriding
makeRequest()
method to support PUT, PATCH, and DELETE, if you are interested I can submit a PR to add such support here as well.The text was updated successfully, but these errors were encountered: