Skip to content

Commit 12d2a0e

Browse files
fix: add scope codes to the stub provider
1 parent f14da77 commit 12d2a0e

File tree

1 file changed

+8
-1
lines changed
  • google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite

1 file changed

+8
-1
lines changed

‎google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/Stubs.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package com.google.cloud.pubsublite;
1616

1717
import com.google.auth.oauth2.GoogleCredentials;
18+
import com.google.common.collect.ImmutableList;
1819
import io.grpc.Channel;
1920
import io.grpc.ManagedChannelBuilder;
2021
import io.grpc.auth.MoreCallCredentials;
@@ -23,11 +24,17 @@
2324
import java.util.function.Function;
2425

2526
public class Stubs {
27+
private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
28+
ImmutableList.of("https://www.googleapis.com/auth/cloud-platform");
29+
2630
public static <StubT extends AbstractStub<StubT>> StubT defaultStub(
2731
String target, Function<Channel, StubT> stubFactory) throws IOException {
2832
return stubFactory
2933
.apply(ManagedChannelBuilder.forTarget(target).build())
30-
.withCallCredentials(MoreCallCredentials.from(GoogleCredentials.getApplicationDefault()));
34+
.withCallCredentials(MoreCallCredentials.from(
35+
GoogleCredentials
36+
.getApplicationDefault()
37+
.createScoped(DEFAULT_SERVICE_SCORES)));
3138
}
3239

3340
private Stubs() {}

0 commit comments

Comments
 (0)