0

I can't understand how to make OAuth 1.0 POST request using Retrofit library in Android.

This is the OAuth 1.0 Post request which I made in Postman enter image description here

Help please, I can not understand how to transfer data such as consumer key, consumer secret, callbakurl to the request method, I think it is not supposed to be by annotations such as @Header or @Query. Also, I do not understand how to indicate in the request method that it is OAuth 1.0 and also that it is Authorization. And also I get a response in the URL format. How can I get the response in the JSON format? Thank you

Artem
  • 93
  • 1
  • 6
  • See here how OAuth 1.0 works https://docs.akana.com/cm/api_oauth/aaref/Ref_OAuth_AuthorizationHeader_10a.htm – tyczj Apr 16 '21 at 16:33
  • @tyczj Do you know how to make a request of step 1 in your example using Retrofit library? – Artem Apr 16 '21 at 18:51
  • There is nothing built in to Retrofit that I am aware of that does this for you, you have to do it manually – tyczj Apr 16 '21 at 18:53
  • You can also check out this question that has some comments that you might find useful https://stackoverflow.com/questions/45577233/oauth-1-0-get-request-retrofit-android – tyczj Apr 16 '21 at 18:55
  • @tyczj So, I cannot implement this request using Retrofit? – Artem Apr 16 '21 at 18:56
  • I did not say that I said you have to create the header yourself, retrofit does not have anything to generate an oauth 1 header for you – tyczj Apr 16 '21 at 18:58
  • @tyczj If Retrofit does not have anything to generate an oauth 1 header for me,I shouldn't look for solutions using a retrofit. Did I understand correctly? – Artem Apr 16 '21 at 19:23
  • The header is just a string of parameters that need to be put together correctly according to the OAuth 1.0 spec, its not about if OAuth 1.0 does or does not work with retrofit (it does its just a header after all) You have to create the string manually and set the header yourself – tyczj Apr 16 '21 at 19:27
  • @tyczj Do you have an example? – Artem Apr 16 '21 at 19:38

0 Answers0