Oauth2 Gem を使用してサービスに接続しています。
認証コードを受け取ることはできますが、そのコードを使用してユーザー トークンを取得すると、Faraday::ConnectionFailed (ファイルの終わりに達しました) が返されます。
その他の問題のほとんどは、期限切れの証明書が原因です。ただし、Heroku にデプロイしても、このエラーは引き続き発生します。
client = OAuth2::Client.new(client_id, client_secret, :site => 'https://auth.mxit.com', :authorize_url => '/authorize', :token_url => '/token')
auth_code1 = client.auth_code.authorize_url(:redirect_uri => root_url+'oauth2/callback', :scope => 'message/send')
auth_code1 =params[:code]
base_code = Base64.encode64(client_id+' : '+client_secret)
token = client.auth_code.get_token(auth_code1, :redirect_uri => root_url+'oauth2', :grant_type =>'authorization_code', :headers => {'Content-Type' => 'application/x-www-form-urlencoded','Authorization' => 'Basic'+base_code })