Following the guide set out here, I was able to generate the base64 token
try {
byte[] byteArray = String.format(Locale.getDefault(), "%s:%s", key, secret)
.getBytes("UTF-8");
String token = Base64.encodeToString(byteArray, Base64.DEFAULT);
// Here is where I make the oauth request
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
The next part to this is to make the api call and get the application specific token (using Retrofit
if possible). This is currently what I have:
@FormUrlEncoded
@POST("/oauth2/token HTTP/1.1")
private void obtainAccessToken() {
final String BASE_URL = "https://api.twitter.com/oauth2/token/";
}
How do I include the other parts and eventually make the request and obtain the token? An example of this in action is seen by this post, however this is in ruby. How do I achieve the same using Retrofit framework?