Here are the examples of the java api class com.google.api.client.auth.oauth2.TokenResponse taken from open source projects.
1. CloudShellCredential#executeRefreshToken()
Project: google-api-java-client
File: CloudShellCredential.java
File: CloudShellCredential.java
@Override protected TokenResponse executeRefreshToken() throws IOException { Socket socket = new Socket("localhost", this.getAuthPort()); socket.setSoTimeout(READ_TIMEOUT_MS); TokenResponse token = new TokenResponse(); try { PrintWriter out = new PrintWriter(socket.getOutputStream(), true); out.println(GET_AUTH_TOKEN_REQUEST); BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream())); // Ignore the size line input.readLine(); Collection<Object> messageArray = jsonFactory.createJsonParser(input).parseArray(LinkedList.class, Object.class); String accessToken = ((List<Object>) messageArray).get(ACCESS_TOKEN_INDEX).toString(); token.setAccessToken(accessToken); } finally { socket.close(); } return token; }
2. TestCredential#executeRefreshToken()
Project: incubator-beam
File: TestCredential.java
File: TestCredential.java
@Override protected TokenResponse executeRefreshToken() throws IOException { TokenResponse response = new TokenResponse(); response.setExpiresInSeconds(5L * 60); response.setAccessToken(token); return response; }
3. TestCredential#executeRefreshToken()
Project: DataflowJavaSDK
File: TestCredential.java
File: TestCredential.java
@Override protected TokenResponse executeRefreshToken() throws IOException { TokenResponse response = new TokenResponse(); response.setExpiresInSeconds(5L * 60); response.setAccessToken(token); return response; }