1
1
package com .google .firebase .samples .config ;
2
2
3
- import com .google .api . client . googleapis . auth .oauth2 .GoogleCredential ;
3
+ import com .google .auth .oauth2 .GoogleCredentials ;
4
4
import com .google .gson .Gson ;
5
5
import com .google .gson .GsonBuilder ;
6
6
import com .google .gson .JsonElement ;
18
18
import java .net .HttpURLConnection ;
19
19
import java .net .URL ;
20
20
import java .util .Arrays ;
21
- import java .util .Collections ;
22
21
import java .util .Scanner ;
23
22
import java .util .zip .GZIPInputStream ;
24
23
import java .util .zip .GZIPOutputStream ;
@@ -42,11 +41,11 @@ public class Configure {
42
41
*/
43
42
// [START retrieve_access_token]
44
43
private static String getAccessToken () throws IOException {
45
- GoogleCredential googleCredential = GoogleCredential
46
- .fromStream (new FileInputStream ("service-account.json" ))
47
- .createScoped (Arrays .asList (SCOPES ));
48
- googleCredential . refreshToken ();
49
- return googleCredential .getAccessToken ();
44
+ GoogleCredentials googleCredentials = GoogleCredentials
45
+ .fromStream (new FileInputStream ("service-account.json" ))
46
+ .createScoped (Arrays .asList (SCOPES ));
47
+ googleCredentials . refreshAccessToken ();
48
+ return googleCredentials .getAccessToken (). getTokenValue ();
50
49
}
51
50
// [END retrieve_access_token]
52
51
@@ -276,4 +275,4 @@ public static void main(String[] args) throws IOException {
276
275
}
277
276
}
278
277
279
- }
278
+ }
0 commit comments