I have a web application and obtain an auth code with which I get a refresh token. I then supply this refresh token to the library and it can obtain a new access code before I access it.
This is how I currently do it for the old version:
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.services.bigquery.Bigquery;
public static final HttpTransport httpTransport = new NetHttpTransport();
public static final JsonFactory jsonFactory = new JacksonFactory();
GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setClientSecrets("client_id", "secret")
.build()
.setFromTokenResponse(new TokenResponse().setRefreshToken("refresh_token");
credential.refreshToken();
Bigquery bigquery = new Bigquery.Builder(httpTransport, jsonFactory, credential)
.setApplicationName("appName").build();
And I would like to build the equivalent with a GoogleCredentials object, which the newer BigQuery library needs - how to do this?
I have a web application and obtain an auth code with which I get a refresh token. I then supply this refresh token to the library and it can obtain a new access code before I access it.
This is how I currently do it for the old version:
And I would like to build the equivalent with a GoogleCredentials object, which the newer BigQuery library needs - how to do this?