Skip to content

Commit 368b821

Browse files
authored
fix: GoogleCredential to GoogleCredentials (#35)
1 parent e66e49f commit 368b821

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

messaging/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ run {
2222
dependencies {
2323
testCompile group: 'junit', name: 'junit', version: '4.12'
2424

25-
compile 'com.google.api-client:google-api-client:1.22.0'
26-
compile 'com.google.code.gson:gson:2.8.1'
25+
compile 'com.google.auth:google-auth-library-oauth2-http:0.26.0'
26+
compile 'com.google.code.gson:gson:2.8.7'
2727
}

messaging/src/main/java/com/google/firebase/quickstart/Messaging.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
packagecom.google.firebase.quickstart;
22

3-
importcom.google.api.client.googleapis.auth.oauth2.GoogleCredential;
3+
importcom.google.auth.oauth2.GoogleCredentials;
44
importcom.google.gson.Gson;
55
importcom.google.gson.GsonBuilder;
66
importcom.google.gson.JsonObject;
@@ -43,11 +43,11 @@ public class Messaging {
4343
*/
4444
// [START retrieve_access_token]
4545
privatestaticStringgetAccessToken() throwsIOException {
46-
GoogleCredentialgoogleCredential = GoogleCredential
47-
.fromStream(newFileInputStream("service-account.json"))
48-
.createScoped(Arrays.asList(SCOPES));
49-
googleCredential.refreshToken();
50-
returngoogleCredential.getAccessToken();
46+
GoogleCredentialsgoogleCredentials = GoogleCredentials
47+
.fromStream(newFileInputStream("service-account.json"))
48+
.createScoped(Arrays.asList(SCOPES));
49+
googleCredentials.refreshAccessToken();
50+
returngoogleCredentials.getAccessToken().getTokenValue();
5151
}
5252
// [END retrieve_access_token]
5353

0 commit comments

Comments
 (0)
close