Firebase ios unable to get timestamp [Firebase/Database][I-RDB038012] Listener at /serverTimestamp failed:...
up vote
0
down vote
favorite
I'm using this code
var currentTimeStamp: TimeInterval?
let ref = Database.database().reference().child("serverTimestamp")
ref.setValue(ServerValue.timestamp())
ref.observe(.value, with: { snap in
if let t = snap.value as? Timestamp {
// print(t/1000)
// currentTimeStamp = t/1000
//Add additional data(Timestamp) to list
mutableData["timestamp"] = currentTimeStamp
//FINALLY , set data
newdoc.setData(mutableData) { (error) in
completion(docID)
}
}
})
got this error
Firebase/Database][I-RDB038012] Listener at /serverTimestamp failed: permission_denied
my rules set to Auth , but auth user still cant get the time stamp
// These rules grant access to a node matching the authenticated
// user's ID from the Firebase auth token
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
I want to write the timestamp inside Firebase Realtime Database current structure is .
myproject [null]
|____ serverTimestamp : 1
Thought I have set the rules to complete public still cant get the timestamp
ios swift firebase firebase-realtime-database
add a comment |
up vote
0
down vote
favorite
I'm using this code
var currentTimeStamp: TimeInterval?
let ref = Database.database().reference().child("serverTimestamp")
ref.setValue(ServerValue.timestamp())
ref.observe(.value, with: { snap in
if let t = snap.value as? Timestamp {
// print(t/1000)
// currentTimeStamp = t/1000
//Add additional data(Timestamp) to list
mutableData["timestamp"] = currentTimeStamp
//FINALLY , set data
newdoc.setData(mutableData) { (error) in
completion(docID)
}
}
})
got this error
Firebase/Database][I-RDB038012] Listener at /serverTimestamp failed: permission_denied
my rules set to Auth , but auth user still cant get the time stamp
// These rules grant access to a node matching the authenticated
// user's ID from the Firebase auth token
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
I want to write the timestamp inside Firebase Realtime Database current structure is .
myproject [null]
|____ serverTimestamp : 1
Thought I have set the rules to complete public still cant get the timestamp
ios swift firebase firebase-realtime-database
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm using this code
var currentTimeStamp: TimeInterval?
let ref = Database.database().reference().child("serverTimestamp")
ref.setValue(ServerValue.timestamp())
ref.observe(.value, with: { snap in
if let t = snap.value as? Timestamp {
// print(t/1000)
// currentTimeStamp = t/1000
//Add additional data(Timestamp) to list
mutableData["timestamp"] = currentTimeStamp
//FINALLY , set data
newdoc.setData(mutableData) { (error) in
completion(docID)
}
}
})
got this error
Firebase/Database][I-RDB038012] Listener at /serverTimestamp failed: permission_denied
my rules set to Auth , but auth user still cant get the time stamp
// These rules grant access to a node matching the authenticated
// user's ID from the Firebase auth token
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
I want to write the timestamp inside Firebase Realtime Database current structure is .
myproject [null]
|____ serverTimestamp : 1
Thought I have set the rules to complete public still cant get the timestamp
ios swift firebase firebase-realtime-database
I'm using this code
var currentTimeStamp: TimeInterval?
let ref = Database.database().reference().child("serverTimestamp")
ref.setValue(ServerValue.timestamp())
ref.observe(.value, with: { snap in
if let t = snap.value as? Timestamp {
// print(t/1000)
// currentTimeStamp = t/1000
//Add additional data(Timestamp) to list
mutableData["timestamp"] = currentTimeStamp
//FINALLY , set data
newdoc.setData(mutableData) { (error) in
completion(docID)
}
}
})
got this error
Firebase/Database][I-RDB038012] Listener at /serverTimestamp failed: permission_denied
my rules set to Auth , but auth user still cant get the time stamp
// These rules grant access to a node matching the authenticated
// user's ID from the Firebase auth token
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
I want to write the timestamp inside Firebase Realtime Database current structure is .
myproject [null]
|____ serverTimestamp : 1
Thought I have set the rules to complete public still cant get the timestamp
ios swift firebase firebase-realtime-database
ios swift firebase firebase-realtime-database
edited Nov 9 at 8:26
KENdi
5,6492821
5,6492821
asked Nov 9 at 3:38
Nekkoko Nabby
51
51
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Your rules are set for the users node. You need to also specify rules for the "serverTimestamp" node.
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
},
"serverTimestamp": {
".read": "auth_uid != null",
".write": "auth_uid != null"
}
}
}
This is if you keep the structure the same.
When you specify rules in Firebase the term they use is atomic, you need to specify rules for each node and each sub node applies rules of the parent before applying their own. Your rules are only for the "$uid" node, you didn't specify any rules for "serverTimestamp" and since "serverTimestamp" doesn't fall under "$uid" permission is denied.
For example with your current permissions if you tried to read/write "users" node you will also get a permission denied. You can only access "users/($uid)/"
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Your rules are set for the users node. You need to also specify rules for the "serverTimestamp" node.
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
},
"serverTimestamp": {
".read": "auth_uid != null",
".write": "auth_uid != null"
}
}
}
This is if you keep the structure the same.
When you specify rules in Firebase the term they use is atomic, you need to specify rules for each node and each sub node applies rules of the parent before applying their own. Your rules are only for the "$uid" node, you didn't specify any rules for "serverTimestamp" and since "serverTimestamp" doesn't fall under "$uid" permission is denied.
For example with your current permissions if you tried to read/write "users" node you will also get a permission denied. You can only access "users/($uid)/"
add a comment |
up vote
0
down vote
accepted
Your rules are set for the users node. You need to also specify rules for the "serverTimestamp" node.
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
},
"serverTimestamp": {
".read": "auth_uid != null",
".write": "auth_uid != null"
}
}
}
This is if you keep the structure the same.
When you specify rules in Firebase the term they use is atomic, you need to specify rules for each node and each sub node applies rules of the parent before applying their own. Your rules are only for the "$uid" node, you didn't specify any rules for "serverTimestamp" and since "serverTimestamp" doesn't fall under "$uid" permission is denied.
For example with your current permissions if you tried to read/write "users" node you will also get a permission denied. You can only access "users/($uid)/"
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Your rules are set for the users node. You need to also specify rules for the "serverTimestamp" node.
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
},
"serverTimestamp": {
".read": "auth_uid != null",
".write": "auth_uid != null"
}
}
}
This is if you keep the structure the same.
When you specify rules in Firebase the term they use is atomic, you need to specify rules for each node and each sub node applies rules of the parent before applying their own. Your rules are only for the "$uid" node, you didn't specify any rules for "serverTimestamp" and since "serverTimestamp" doesn't fall under "$uid" permission is denied.
For example with your current permissions if you tried to read/write "users" node you will also get a permission denied. You can only access "users/($uid)/"
Your rules are set for the users node. You need to also specify rules for the "serverTimestamp" node.
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
},
"serverTimestamp": {
".read": "auth_uid != null",
".write": "auth_uid != null"
}
}
}
This is if you keep the structure the same.
When you specify rules in Firebase the term they use is atomic, you need to specify rules for each node and each sub node applies rules of the parent before applying their own. Your rules are only for the "$uid" node, you didn't specify any rules for "serverTimestamp" and since "serverTimestamp" doesn't fall under "$uid" permission is denied.
For example with your current permissions if you tried to read/write "users" node you will also get a permission denied. You can only access "users/($uid)/"
answered Nov 9 at 6:35
Alexander
13619
13619
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219510%2ffirebase-ios-unable-to-get-timestamp-firebase-databasei-rdb038012-listener-a%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown