Fix update to deprecated Google Drive credential code
No issue. Restore missing piece of commit so that Builder
has the method parameter that it needs.
@@ -11,6 +11,7 @@ import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl;
+import com.google.api.client.auth.oauth2.BearerToken;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest;
import com.google.api.client.auth.oauth2.Credential;
@@ -110,7 +111,7 @@ abstract public class GoogleAPIExtension {
}
static public Drive getDriveService(String token) {
- Credential credential = new Credential.Builder(null).build().setAccessToken(token);
+ Credential credential = new Credential.Builder(BearerToken.authorizationHeaderAccessMethod()).build().setAccessToken(token);
return new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).setHttpRequestInitializer(new HttpRequestInitializer() {
@Override
