Reputation: 149
This is my curl request
`curl --insecure --location --request POST 'url' --header 'Content-Type: application/json' --data-raw '{
"client_id": "test"
}'
This worked fine!
Now this is my elixir request
HTTPoison.post("url", request, ssl: [verify: :verify_none])
Here I am getting error
{:error,
%HTTPoison.Error{
id: nil,
reason: {:tls_alert,
{:handshake_failure,
'TLS client: In state certify at ssl_handshake.erl:1783 generated CLIENT ALERT: Fatal - Handshake Failure\n {bad_cert,unable_to_match_altnames}'}}
}}
`
Upvotes: 2
Views: 3171
Reputation: 66
You could try to force ssl to tlsv1.2
.
HTTPoison.post("url", request, ssl: [versions: [:"tlsv1.2"]])
If this not works, try to remove ssl
key and/or if you are using hackney
you could try to configure with insecure
option.
HTTPoison.post("url", request)
HTTPoison.post("url", request, [hackney: [:insecure]])
HTTPoison.post("url", request, [ssl: [versions: [:"tlsv1.2"]], hackney: [:insecure]])
By the way, which version of Erlang are you using?
The first recommendation was discussed here.
Upvotes: 2