简体   繁体   English

如何使用 retrofit 发送带有 oAuth 1.0 的 post 请求?

[英]How to send post request with oAuth 1.0 using retrofit?

I want to send post request with retrofit with additional things like oAuth 1.0, Consumer Key and Consumer secret Image for explain briefly我想发送带有 retrofit 的帖子请求,以及oAuth 1.0、消费者密钥和消费者秘密图像等附加内容,以便简要说明

and I want to send data with raw inside body我想用rawbody数据发送数据

Request i want to send :我要发送的请求

InputFormat=application/json&InputData={
   "provider":"fb",
   "profileId":"ashok",
   "email":"ashok.kom",
   "MobileNo":"91-868",
   "FirstName":"Ashok",
   "LastName":"Komara",
   "gender":"M",
   "loginId":"ashok",
   "subscribeToOffers":"true"
}

My Api service我的 Api 服务

public interface APIService {

    @Headers({"Content-Type: application/x-www-form-urlencoded",
    "Accept: application/json",
    "Consumer_Key: HHAKRMFG",
    "Signature_Method: HMAC-SHA1",
    "OAuth_Version: 1.0",
    "Consumer_Secret: DPNQGUX1TKRYGWJOPH5DBLRB"})
    @POST("LoginWithThirdPartyProvider")
    @FormUrlEncoded
    Call<ResponseList> savePost(@Field("provider") String provider,
                                @Field("profileId") String profileId,
                                @Field("email") String email,
                                @Field("MobileNo") String MobileNo,
                                @Field("FirstName") String FirstName,
                                @Field("LastName") String LastName,
                                @Field("gender") String gender,
                                @Field("loginId") String loginId,
                                @Field("subscribeToOffers") String subscribeToOffers);
}

我在邮递员中的标题

I have got got a way to do this or can say I have got answer of my question我有办法做到这一点,或者可以说我已经回答了我的问题

This library help me to use retrofit with oAuth 1.0 这个库帮助我使用retrofitoAuth 1.0

In the mid I got lot of minor errors which are easily resolve by searching on Internet中间我遇到了很多小错误,通过在互联网上搜索很容易解决

If you are using this library don't forget to add如果您正在使用此库,请不要忘记添加
<uses-library android:name="org.apache.http.legacy" android:required="false" />

in you <application tag在你的<application标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM