The following versions of the Admin SDKs introduce a limited number of breaking changes:
- Java SDK 6.0.0
- Go SDK 3.0.0
The change with the broadest impact is the removal of the Java
Taskinterface, which is replaced by the
ApiFuture interface.
Additionally, there are changes to these features:
- Specifying authorization credentials for the Java SDK
- Configuring Realtime Database log levels
- Creating custom tokens and verifying ID tokens in Go
Admin Java SDK (6.0.0)
Use ApiFuture instead of Task
The deprecated Task interface has
been removed. If your app uses this interface, update it to use the
ApiFutures interface instead. For example:
Before
Task<String> customToken = FirebaseAuth.getInstance()
.createCustomToken("uid");
After
String customToken = FirebaseAuth.getInstance()
.createCustomToken("uid");
// Or
ApiFuture<String> customToken = FirebaseAuth.getInstance()
.createCustomTokenAsync("uid");
For a detailed discussion of this change with advanced use case examples, see Asynchronous Operations with Admin Java SDK.
Migrate FirebaseCredentials to GoogleCredentials
FirebaseCredential and FirebaseCredentials are no longer available.
To specify authorization credentials for the SDK, use
GoogleCredentials instead. For example:
Before
FirebaseCredential credential = FirebaseCredentials.fromCertificate(stream);
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredential(credential)
.build();
FirebaseCredential credential = FirebaseCredentials.applicationDefault();
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredential(credential)
.build();
After
GoogleCredentials credentials = GoogleCredentials.fromStream(stream);
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(credentials)
.build();
GoogleCredentials credentials = GoogleCredentials.getApplicationDefault();
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(credentials)
.build();
Use SLF4J to configure logging
The FirebaseDatabase.setLogLevel() API is no longer available.
Use SLF4J directly to configure logging for
the entire SDK.
This change means that logging now can be configured without code changes. For more information see Logging in Java libraries for Firebase and Google Cloud.
Before
FirebaseDatabase.getInstance()
.setLogLevel(Logger.Level.DEBUG);
After
- Add
slf4j-simple.jarto the project classpath. - Set the
-Dorg.slf4j.simpleLogger.defaultLogLevel=debugsystem property for the JVM. - Refer to SLF4J documentation for details about using other logging
frameworks like Log4J and
java.util.logging.
Admin Go SDK 3.0.0
Changes in auth.Client for Go
The CustomToken and CustomTokeWithClaims methods now take a context
argument, like the majority of existing Go APIs.
Before
token, err := CustomToken("uid")
token, err := CustomToken("uid", claimsMap)
result, err := VerifyIDToken(idToken)
After
token, err := CustomToken(context.Background(), "uid")
token, err := CustomTokenWithClaims(context.Background(), "uid", claimsMap)
result, err := VerifyIDToken(context.Background(), idToken)

