-
Notifications
You must be signed in to change notification settings - Fork 453
Closed
Description
function getFirebaseService() {
var scriptProperties = PropertiesService.getScriptProperties();
var PRIVATE_KEY = scriptProperties.getProperty('FB_PRIVATE_KEY');
var CLIENT_EMAIL = scriptProperties.getProperty('FB_CLIENT_EMAIL');
return OAuth2.createService('Firebase')
.setTokenUrl('https://accounts.google.com/o/oauth2/token')
.setPrivateKey(PRIVATE_KEY)
.setIssuer(CLIENT_EMAIL)
.setPropertyStore(scriptProperties)
.setScope('https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/firebase.database');
}
function updateFBase() {
var service = getFirebaseService();
service.reset();
Logger.log(service.hasAccess());
if (service.hasAccess()) {
var fb = FirebaseApp.getDatabaseByUrl("https://wsy-calendar.firebaseio.com/", service.getAccessToken());
fb.setData("users/" + "test", "testdata");
} else {
Logger.log(service.getLastError());
}
Using a service account for Firebase and following the sample, when I call service.hasAccess()
I get false
. service.getLastError()
shows Exception: Invalid argument: key
. The credentials are valid as I'm already successfully using them in a node application. Any thoughts on where I might be going wrong?
Metadata
Metadata
Assignees
Labels
No labels