PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, February 17, 2022

[FIXED] PHP- No option to authenticate user in firebase-php

 February 17, 2022     firebase, firebase-authentication, laravel-5     No comments   

Issue

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

Solution

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.



Answered By - Frank van Puffelen
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing