I am trying to call Context.io API from Android which is based on Oauth 1.0 Authentication.
Can you please suggest me how I can create request for Oauth1.0 standard or Please, anyone can provide me the sample code of Oauth1.0 request example on that standard.
Thank you very much.
You can use scriblejava library to access Oauth 1.0 2-legged APIs.
In Android Studio App griddle add following dependency:
compile 'org.scribe:scribe:1.3.5'
And simply use following code:
String consumerKey = "XXXX"; //api key
String consumerSecret = "XXXX"; //api secret
String requestUrl = "your context.io request url";
OAuthService service = new ServiceBuilder()
.provider(OAuthProvider.class)
.apiKey(consumerKey)
.apiSecret(consumerSecret)
.build();
OAuthRequest request = new OAuthRequest(Verb.GET, requestUrl);
Token accessToken = new Token("", ""); //not required for context.io
service.signRequest(accessToken, request);
Response response = request.send();
Log.d("OAuthTask",response.getBody());
Hope it helped!