Class CloudShellCredentials (1.50.0)
Stay organized with collections
Save and categorize content based on your preferences.
1.50.0 (latest)
1.49.0
1.48.0
1.46.0
1.43.0
1.42.1
1.41.0
1.40.0
1.39.1
1.38.0
1.37.1
1.36.0
1.35.0
1.34.0
1.33.1
1.32.1
1.31.0
1.30.1
1.29.1-SNAPSHOT
1.28.0
1.27.0
1.26.0
1.25.0
1.24.1
1.20.0
1.19.0
1.18.0
1.7.0
1.6.1
1.4.0
1.3.0
public class CloudShellCredentials extends GoogleCredentials
OAuth2 credentials representing the built-in service account for Google Cloud Shell.
Static Fields
GET_AUTH_TOKEN_REQUEST
protected static final String GET_AUTH_TOKEN_REQUEST
The Cloud Shell back authorization channel uses serialized Javascript Protobuffers, preceded by
the message length and a new line character. However, the request message has no content, so a
token request consists of an empty JsPb, and its 2 character length prefix.
Field Value
Type
Description
String
GET_AUTH_TOKEN_REQUEST_BYTES
protected static final byte [] GET_AUTH_TOKEN_REQUEST_BYTES
Field Value
Type
Description
byte []
Static Methods
create(int authPort)
public static CloudShellCredentials create ( int authPort )
Parameter
Name
Description
authPort
int
newBuilder()
public static CloudShellCredentials . Builder newBuilder ()
Methods
equals(@Nullable Object obj)
public boolean equals ( @Nullable Object obj )
Parameter
Name
Description
obj
@org.jspecify.annotations.Nullable java.lang.Object
Overrides
getAuthPort()
protected int getAuthPort ()
Returns
Type
Description
int
hashCode()
Returns
Type
Description
int
Overrides
refreshAccessToken()
public AccessToken refreshAccessToken ()
Method to refresh the access token according to the specific type of credentials.
Throws IllegalStateException if not overridden since direct use of OAuth2Credentials is only
for temporary or non-refreshing access tokens.
Overrides
toBuilder()
public CloudShellCredentials . Builder toBuilder ()
Overrides
toString()
Returns a string representation of this credential, including request metadata and access
token.
Security Warning: The output of this method includes the request metadata which
contains the raw Bearer access token, and the raw access token value. Do not log this output in
production environments as it may expose sensitive credentials.
Returns
Type
Description
String
Overrides
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-08-04 UTC.
[null,null,["Last updated 2026-08-04 UTC."],[],[]]