Alia Jain
Alia Jain

Reputation: 19

PHP- No option to authenticate user in firebase-php

I am trying to identify if I have set security rules in the users node like below

Users:
  $uid:
    write: auth.uid != null,
    read : auth.uid != null,

What I don't understand how to authenticate users with PHP. As document doesn't provide me any sign-in functionality as in JavaScript .Because until and unless I authenticate the user. It doesn't allow me to update values in user's nodes due to security rules.

Using laravel/firebase-php V4.29
Firebase SDK 8.4
Language - PHP

Upvotes: 0

Views: 252

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598750

Firebase Authentication code runs client-side, so in the browser or in the native app. The PHP code that you have runs on the server, where you can't sign in a user. The server-side code itself runs with administrative privileges, as you configure it with a service account.

If you are interacting with the database directly from the client-side code too, you'll want to include the JavaScript SDK in your client-side, and sign in the user there as shown in the documentation.

If you're interacting with the database from the server-side PHP code, that should already work as using a service account means your code bypasses the security rules. If this isn't working for you, please edit your question to show how you configure the SDK.

Upvotes: 1

Related Questions