I want to pass access token for get the list of files from google drive.
What I have done :
Register app to Google dev console.
I have client id based on OAuth 2.0
What i want to do :
Call HttpCall
for https://www.googleapis.com/drive/v2/files
I want to set access token in header like this :
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost post = new HttpPost("https://www.googleapis.com/drive/v2/files");
post.addHeader("Content-Type", "application/json");
post.addHeader("Authorization","Bearer XXXXXXXXXXXXXXXXXXXXXXXXX");
How can I get access token for Authorization by using OAuth2.0
Client Id
If you are making calls with scopes that are available in GDAA then that would be your best bet.
Otherwise you could use the Google Drive Java client library. In this instance you can use the GoogleAccountCredential for Auth, which will contain the access token, however you will not need to use it directly. See an example here.