Closed enisgur closed 5 years ago
Hi @enisgur ,
If you are trying to access to a protected service with OAuth2, you shouldn't need to make the request manually, you only need to setup properly the Oauth2 settings, and before try to access to any endpoint in your secured service, reqclient will try to authenticate first. Take a look a the Twitter example here,where the intend is to try to access to the "trends/place.json" endpoint, but because RequestClient
object was created with the oauth2
settings, the library try first to get the token using those settings against the OAuth2 endpoint.
But taking one more look to your example, you are trying to send also an "authorization" header, with a "Basic" token, so I not sure what is your intend.
But here are some observations:
auth
setting in the constructor, you are using HTTP Basic Authentication, that it's translated to a "authorization" header automatically, but you are also sending an "authorization" header in the request, so one is overwriting the other. The auth
object it's just a convenient way to encode the string that the Basic method requires.RequestClient
constructor the option contentType: "formData"
. That is the reason because the server is responding _The granttype parameter is required despite you are sending it (but with the wrong encoding),Hey @enisgur ,
Did you solve the issue?
thank you for your help. Yes I solve the issue. Thanks again
I need help to get my access_token. it had been a week but still could't find out how, and decide to request help from here. I am trying to request post to oauth.opskins but it doesn't see my parametes. How can I send required parameters to server?
I am getting this output
[Response access_token]<- Status 400 - {"error":"invalid_request","error_description":"The grant_type parameter is required"}