Home > Net >  Firebase : Read and Write Data on the Web : How to add an access token to a set and get request
Firebase : Read and Write Data on the Web : How to add an access token to a set and get request

Time:02-03

I'm working with firebase auth and firebase real time database to retrieve data.

I added security rules to retrieve data only for granted users

According to firebase dodumentation, for Rest api request with axios it works like that :

axios.get(url?auth="accessToken")

I'm wondering how to add this accessToken with get and set methods provided by firebase firebase Read and Write Data on the Web

Examle that did not work :

set(ref(this.db, `requests?auth=${accessToken}`), data)

The error : Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"

CodePudding user response:

The auth query parameter is required only when you are using Firebase REST APIs. When using Firebase SDKs, user authentication is handled for you by the SDKs as long as the user is logged in with Firebase Authentication.

  • Related