Created
June 6, 2013 09:04
-
-
Save smaspe/5720280 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class TokenRequest extends StringRequest { | |
TokenRequest(int method, String url, Listener<String> listener, | |
ErrorListener errorListener) { | |
super(method, url, listener, errorListener); | |
} | |
@Override | |
protected Map<String, String> getParams() throws AuthFailureError { | |
Map<String, String> params = new HashMap<String, String>(); | |
params.put("grant_type", "client_credentials"); | |
return params; | |
} | |
@Override | |
public Map<String, String> getHeaders() throws AuthFailureError { | |
Map<String, String> headers = new HashMap<String, String>(); | |
String auth = "Basic " | |
+ Base64.encodeToString((TwitterValues.CONSUMER_KEY | |
+ ":" + TwitterValues.CONSUMER_SECRET).getBytes(), | |
Base64.NO_WRAP); | |
headers.put("Authorization", auth); | |
return headers; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment