I am facing an issue in getting the twitter bearer token for my application.
Although, I received the successful response from Twitter as mentioned below: "POST https://api.twitter.com/oauth2/token?grant_type=client_credentials returned a response status of 200 OK".
But when I try to retrieve the bearer token from the response by using the below statement, I get a long queue of junk characters:
String str = response.getEntity(String.class);
Further to that i tried two more approaches:
1) The getHeaders method returned:
content-disposition=[attachment; filename=json.json]
So, it looks like that server is sending back the token in an attachment file so I changed the above to:
File r_file = response.getEntity(File.class);
But this temp file also consists of junk characters only
2) I tried to decode these characters using Base64, but even that threw back an error.