firebase-admin

How to get Firebase user id from FCM token? (in admin code on server)

ε祈祈猫儿з 提交于 2020-05-23 10:49:29
问题 My signed-in Android clients register their tokens with my server. The problem is I am not sure whether the token sent by a particular client genuinely belongs to that client user id. A bad client could register valid tokens of other users. Given an FCM token and a user id, how can my admin code on the server verify that the token indeed belongs to the (authenticated) user id? 回答1: On a Firebase level there is no connection between a Authentication UID, and a Cloud Messaging Instance ID token

Firebase Firestore Server Timestamp with firebase-admin python sdk

 ̄綄美尐妖づ 提交于 2020-05-16 03:13:08
问题 There is a way to add server timestamps in firebase-admin python sdk ? I try: firestore.SERVER_TIMESTAMP firestore.constants.SERVER_TIMESTAMP but, i get this exception: TypeError: ('Cannot convert to a Firestore Value', <object object at 0x10380fc20>, 'Invalid type', <class 'object'>) 回答1: firestore.SERVER_TIMESTAMP worked for me. Here's the full example: import firebase_admin from firebase_admin import firestore # I have GOOGLE_APPLICATION_CREDENTIALS configured. firebase_admin.initialize

Check if user logged in from backend Firebase Authentication

一世执手 提交于 2020-05-15 09:21:52
问题 In my frontend, the user logs in using Firebase Authentication Browser. That part works perfectly fine. In addition to Firebase backend, I also have NodeJS backend that serves additional content. However, I need to serve the content to only Authenticated user. My question is: Is there a way for my NodeJS backend to know that a user has been authenticated when they make a request? 回答1: An authenticated client is issued an ID token that uniquely identifies the user. The client can get this this

Check if user logged in from backend Firebase Authentication

北城以北 提交于 2020-05-15 09:21:45
问题 In my frontend, the user logs in using Firebase Authentication Browser. That part works perfectly fine. In addition to Firebase backend, I also have NodeJS backend that serves additional content. However, I need to serve the content to only Authenticated user. My question is: Is there a way for my NodeJS backend to know that a user has been authenticated when they make a request? 回答1: An authenticated client is issued an ID token that uniquely identifies the user. The client can get this this

Check if user logged in from backend Firebase Authentication

本小妞迷上赌 提交于 2020-05-15 09:20:50
问题 In my frontend, the user logs in using Firebase Authentication Browser. That part works perfectly fine. In addition to Firebase backend, I also have NodeJS backend that serves additional content. However, I need to serve the content to only Authenticated user. My question is: Is there a way for my NodeJS backend to know that a user has been authenticated when they make a request? 回答1: An authenticated client is issued an ID token that uniquely identifies the user. The client can get this this

How to fix Firebase_Admin Error TypeError: __init__() got an unexpected keyword argument 'status'

妖精的绣舞 提交于 2020-05-09 04:33:10
问题 I'm new to Firebase and I am following their tutorial online. I'm trying to authenticate into a quick DB that I created with a few records. I'm getting the error: TypeError: init () got an unexpected keyword argument 'status' I've made sure my urllib3 is up to date and confirmed my firebase_Admin is up to date. I've checked my file path for json file and copied my database URL into it. import firebase_admin from firebase_admin import credentials from firebase_admin import db #Generated from

How to fix Firebase_Admin Error TypeError: __init__() got an unexpected keyword argument 'status'

蹲街弑〆低调 提交于 2020-05-09 04:32:10
问题 I'm new to Firebase and I am following their tutorial online. I'm trying to authenticate into a quick DB that I created with a few records. I'm getting the error: TypeError: init () got an unexpected keyword argument 'status' I've made sure my urllib3 is up to date and confirmed my firebase_Admin is up to date. I've checked my file path for json file and copied my database URL into it. import firebase_admin from firebase_admin import credentials from firebase_admin import db #Generated from

How to fix Firebase_Admin Error TypeError: __init__() got an unexpected keyword argument 'status'

妖精的绣舞 提交于 2020-05-09 04:32:10
问题 I'm new to Firebase and I am following their tutorial online. I'm trying to authenticate into a quick DB that I created with a few records. I'm getting the error: TypeError: init () got an unexpected keyword argument 'status' I've made sure my urllib3 is up to date and confirmed my firebase_Admin is up to date. I've checked my file path for json file and copied my database URL into it. import firebase_admin from firebase_admin import credentials from firebase_admin import db #Generated from

How to compare firebase timestamps?

烂漫一生 提交于 2020-04-16 03:20:53
问题 I have cloud function code code like this: console.log(`ts: ${(element.get('expire') as admin.firestore.Timestamp).toDate().toUTCString()} now: ${admin.firestore.Timestamp.now().toDate().toUTCString()}`) const greater = (element.get('expire') as admin.firestore.Timestamp) > admin.firestore.Timestamp.now() const lower = (element.get('expire') as admin.firestore.Timestamp) < admin.firestore.Timestamp.now() console.log(`greater: ${greater} lower: ${lower}`) In console: ts: Mon, 08 Apr 2019 20:59

How to compare firebase timestamps?

强颜欢笑 提交于 2020-04-16 03:20:06
问题 I have cloud function code code like this: console.log(`ts: ${(element.get('expire') as admin.firestore.Timestamp).toDate().toUTCString()} now: ${admin.firestore.Timestamp.now().toDate().toUTCString()}`) const greater = (element.get('expire') as admin.firestore.Timestamp) > admin.firestore.Timestamp.now() const lower = (element.get('expire') as admin.firestore.Timestamp) < admin.firestore.Timestamp.now() console.log(`greater: ${greater} lower: ${lower}`) In console: ts: Mon, 08 Apr 2019 20:59