public final class FirebaseCredentials
extends java.lang.Object
implements com.google.api.client.http.HttpRequestInitializer
This type can be used as an authentication facility for the requests to Firebase REST API.
See Firebase REST docs.
Modifier and Type | Method and Description |
---|---|
static FirebaseCredentials |
empty()
Creates an empty instance of
FirebaseCredentials . |
static FirebaseCredentials |
fromGoogleCredentials(com.google.api.client.googleapis.auth.oauth2.GoogleCredential credentials)
Deprecated.
please use
FirebaseCredentials.fromGoogleCredentials(GoogleCredentials) or any other
alternative instead |
static FirebaseCredentials |
fromGoogleCredentials(com.google.auth.oauth2.GoogleCredentials credentials)
Creates a new
FirebaseCredentials from the given GoogleCredentials . |
static FirebaseCredentials |
fromStream(java.io.InputStream credentialStream)
Creates a new instance of the
FirebaseCredentials from the given credential stream. |
boolean |
isEmpty()
Checks if the instance of the
FirebaseCredentials is empty. |
public static FirebaseCredentials empty()
FirebaseCredentials
.FirebaseCredentials
public static FirebaseCredentials fromGoogleCredentials(com.google.auth.oauth2.GoogleCredentials credentials)
FirebaseCredentials
from the given GoogleCredentials
.
This method sets scopes required to use the Firebase database.
This method is useful to create credentials from the application default credentials.
credentials
- the credentials to create fromFirebaseCredentials
@Deprecated public static FirebaseCredentials fromGoogleCredentials(com.google.api.client.googleapis.auth.oauth2.GoogleCredential credentials)
FirebaseCredentials.fromGoogleCredentials(GoogleCredentials)
or any other
alternative insteadFirebaseCredentials
from the given GoogleCredentials
.
This method sets scopes required to use the Firebase database.
public static FirebaseCredentials fromStream(java.io.InputStream credentialStream)
FirebaseCredentials
from the given credential stream.
Typically the stream will contain a service account JSON file data.
See docs for details on how to obtain the file.
credentialStream
- the stream containing credentials dataFirebaseCredentials
java.lang.IllegalArgumentException
- in case there are problems with parsing the given stream into
GoogleCredentials
public boolean isEmpty()
FirebaseCredentials
is empty.true
if FirebaseCredentials
are empty and false
otherwise