Created
November 27, 2017 03:13
-
-
Save hiranya911/9461ea4119aaf8ad7037d578b570e1e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void initWithLimitedPrivileges() { | |
// Initialize the app with a custom auth variable, limiting the server's access | |
Map<String, Object> auth = new HashMap<String, Object>(); | |
auth.put("uid", "my-service-worker"); | |
FirebaseOptions options = new FirebaseOptions.Builder() | |
.setCredentials(GoogleCredentials.getApplicationDefault()) | |
.setDatabaseUrl("https://databaseName.firebaseio.com") | |
.setDatabaseAuthVariableOverride(auth) | |
.build(); | |
FirebaseApp.initializeApp(options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment