Skip to content

Commit c092525

Browse files
kroikiesamtstern
authored andcommitted
Show possible use of multiple scopes (#25)
1 parent b75ae82 commit c092525

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

config/src/main/java/com/google/firebase/samples/config/Configure.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.io.PrintWriter;
1616
import java.net.HttpURLConnection;
1717
import java.net.URL;
18+
import java.util.Arrays;
1819
import java.util.Collections;
1920
import java.util.Scanner;
2021
import java.util.zip.GZIPInputStream;
@@ -28,7 +29,7 @@ public class Configure {
2829
private final static String PROJECT_ID = "<YOUR-PROJECT-ID>";
2930
private final static String BASE_URL = "https://firebaseremoteconfig.googleapis.com";
3031
private final static String REMOTE_CONFIG_ENDPOINT = "/v1/projects/" + PROJECT_ID + "/remoteConfig";
31-
private final static String REMOTE_CONFIG_SCOPE = "https://www.googleapis.com/auth/firebase.remoteconfig";
32+
private final static String[] SCOPES = { "https://www.googleapis.com/auth/firebase.remoteconfig" };
3233

3334
/**
3435
* Retrieve a valid access token that can be use to authorize requests to the Remote Config REST
@@ -40,7 +41,7 @@ public class Configure {
4041
private static String getAccessToken() throws IOException {
4142
GoogleCredential googleCredential = GoogleCredential
4243
.fromStream(new FileInputStream("service-account.json"))
43-
.createScoped(Collections.singleton(REMOTE_CONFIG_SCOPE));
44+
.createScoped(Arrays.asList(SCOPES));
4445
googleCredential.refreshToken();
4546
return googleCredential.getAccessToken();
4647
}

0 commit comments

Comments
 (0)