We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Jason.DecodeError
ExForce.OAuth.get_token/2
This just started happening today:
{:error, {Tesla.Middleware.JSON, :decode, %Jason.DecodeError{ data: <<...REDACTED...>>, position: 0, token: nil }}}
Dug in a bit, and the order of the Tesla.Middleware makes a difference here for some reason.
These don't work:
ExForce.OAuth.get_token( instance_url, grant_type: "refresh_token", client_id: client_id, client_secret: client_secret, refresh_token: refresh_token )
instance_url |> ExForce.Client.build_oauth_client() |> Tesla.post( instance_url <> "/services/oauth2/token", %{ grant_type: "refresh_token", client_id: client_id, client_secret: client_secret, refresh_token: refresh_token } )
[ {Tesla.Middleware.BaseUrl, instance_url}, {Tesla.Middleware.Compression, format: "gzip"}, Tesla.Middleware.FormUrlencoded, {Tesla.Middleware.DecodeJson, engine: Jason}, {Tesla.Middleware.Headers, []} ] |> Tesla.client() |> Tesla.post( "/services/oauth2/token", %{ grant_type: "refresh_token", client_id: client_id, client_secret: client_secret, refresh_token: refresh_token } )
(This one ^^^ is basically ExForce.Client.Tesla.build_oauth_client/2)
ExForce.Client.Tesla.build_oauth_client/2
But moving Tesla.Middleware.DecodeJson first in the list of middleware does, and yields an {:ok, %Tesla.Env{}} tuple with decoded JSON body:
Tesla.Middleware.DecodeJson
{:ok, %Tesla.Env{}}
body
[ {Tesla.Middleware.DecodeJson, engine: Jason}, {Tesla.Middleware.BaseUrl, instance_url}, {Tesla.Middleware.Compression, format: "gzip"}, Tesla.Middleware.FormUrlencoded, {Tesla.Middleware.Headers, []} ] |> Tesla.client() |> Tesla.post( "/services/oauth2/token", %{ grant_type: "refresh_token", client_id: client_id, client_secret: client_secret, refresh_token: refresh_token } )
The text was updated successfully, but these errors were encountered:
Update: This seems to actually be an issue with bumping tesla from 1.4.4 to 1.5.1...
tesla
1.4.4
1.5.1
...though this could be fixed by switching the order of the middleware: #42
Sorry, something went wrong.
config.exs
No branches or pull requests
This just started happening today:
Dug in a bit, and the order of the Tesla.Middleware makes a difference here for some reason.
These don't work:
(This one ^^^ is basically
ExForce.Client.Tesla.build_oauth_client/2
)But moving
Tesla.Middleware.DecodeJson
first in the list of middleware does, and yields an{:ok, %Tesla.Env{}}
tuple with decoded JSONbody
:The text was updated successfully, but these errors were encountered: