Reputation: 58
I am trying to sign up users on Firebase Auth using Google Apps Script via the Firebase Auth REST API.
My code looks this.
var apiKey = "XXXX";
var url = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?key=" + apiKey;
var options = {
method: 'post',
contentType: 'application/json',
email: "[email protected]",
password: "12345678",
returnSecureToken: true
};
var response = UrlFetchApp.fetch(url, options);
I am receving the following error.
{
"error": {
"code": 400,
"message": "ADMIN_ONLY_OPERATION",
"errors": [
{
"message": "ADMIN_ONLY_OPERATION",
"domain": "global",
"reason": "invalid"
}
]
}
}
How do I go about this?
Upvotes: 4
Views: 1099
Reputation: 5706
Request body payload should be sent as a 'payload' property of the options object.
var payload = {
email: "[email protected]",
password: 12345678,
returnSecureToken: true
};
var options = {
method: 'post',
contentType: 'application/json',
payload: JSON.stringify(payload)
};
Upvotes: 3