1
votes

I was wondering, how can I authenticate requests to FireBase?

I have created new firebase account, marked Enable Email & Password Authentication, created a user with e-mail/password and using { ".read": "auth != null" } in security rules for read access.

Using PostMan plugin for chrome, selected basic auth, entered e-mail/password, GET to https://crackling-fire-NNNN.firebaseio.com/key.json but I always get { "error": "Permission denied" }. It is working if I remove security rules.

HTTPS Basic Auth is not allowed in FireBase?

Can anyone provide some simples examples in pure HTTP how to authenticate GET/PUT/DELETE requests?

Thanks!

3

3 Answers

1
votes

If I understand you question, you would like to use firebase purely with REST services, including authentication. For what I understand, if you want to do that you will need a server that generates a token that then you can append to the querystring. So if what you want is a serverless app that uses REST services, including logging in, the answer is you cannot. Correct me If I'm wrong

5
votes

I am posting this answer only to help other users to understand how FireBase works.

What I needed was to create an application that allows user (with password) to access his data stored on some server using REST. I thought that I could use FireBase to do that.

But. I have investigated a little bit and find out that FireBase uses JSON Web Tokens (JWT) to authenticate users. Token generation should be done on (other) server side, because it uses FireBase secret. So, apparently you can't send username&password to FireBase. FireBase SDK to be used by another server, and not client. Please feel free to correct me if I am wrong.