Closed joobisb closed 5 years ago
@joobisb can you please try with master
?
@scrogson I tried by importing this in mix.exs
def application do
# Add the application to your list of applications.
# This will ensure that it will be included in a release.
[applications: [:logger, :oauth2]]
end
defp deps do
# Add the dependency
[{:oauth2, "~> 1.0"}]
end
What should I do to try in master?
{:oauth2, github: “scrogson/oauth2”}
@scrogson I tried but still getting same error response. Does it have something to do with content-type?
I believe the content-type is set for you automatically.
Just to make sure...did you run mix does.update oauth2
after changing the dependency in mix.exs
?
yes I did that
@scrogson So what might be the issue?
Next thing to try is to turn on hackney tracing and figure out what is being sent to the server. Place this before the call to get_token
:
:hackney_trace.enable(:max, :io)
@scrogson The issue is solved. By default the accept and content-type header was application/x-www-form-urlencoded
and that was causing the problem. I changed accept header to */*
and I got the access token. Thanks for helping me to trace it out.
@scrogson This is my curl request and I'm getting the access token successfully.
curl -X POST --user <client_id>:<client_secret> '<site_url>/oauth2/token?grant_type=client_credentials' -H 'Content-Type: application/x-www-form-urlencoded'
Following are the steps I followed
I,m getting response as 405 method not allowed as below