简体   繁体   中英

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

and I want to send data with raw inside body

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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