Using Firebase with Joomla - best approaches

1,438 views
Skip to first unread message

Andy Burnett

unread,
May 16, 2014, 1:49:45 PM5/16/14
to fireba...@googlegroups.com
We would like to add some real time capabilities to our Joomla based site.

At the simplest level, we would like to show which users are actually online now, and be able to have a chat capability.  What I would like to know is the best way to integrate Joomla with Firebase, particularly with regards to authentication.  Should we use the PHP library to add users to Firebase, when they log in to Joomla, and then user their login ids as keys to build the chat application etc. Or, is there a better approach?

Cheers
Andy

Kevin Simper

unread,
May 18, 2014, 6:59:59 PM5/18/14
to fireba...@googlegroups.com
That is a very general question, but weather you use Joomla or Wordpress or Laravel makes no difference.

The easiest would be to use the javascript api, if you want to know if people are presence :)

Andy Burnett

unread,
May 22, 2014, 2:06:18 PM5/22/14
to fireba...@googlegroups.com
Hi Kevin,

Thanks for the response. I can see that the javascript api would be the best approach for accessing people's status. My query is really about how we tie the authentication into the Joomla website, i.e. we want people to authenticate with the site first, and for that to add them to the firebase database to show they are present.

After looking into it a bit further, it seems as though generating a JWT for each user might be the best approach, but we could also use the PHP library to get the server to communicate directly with Firebase, and write the user into the database.

Has anyone had any experience with this?

Cheers
Andy


--
You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/JSR7UHVgT4g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Wulf

unread,
May 22, 2014, 4:29:13 PM5/22/14
to fireba...@googlegroups.com
Creating a token with the user's Joomla ID/creds inside should be quite convenient, whether or not you use PHP to communicate directly. This would allow your security rules to interact with data in a sophisticated way.

For example, let's say that I want to utilize users' roles in Joomla to determine their chat permissions (moderator, guest, etc). I can drop those right into the auth token:

var token = tokenGenerator.createToken({joomlaRole: "admin", joomlaId: "kato123"});

Now I can directly control chat access using those creds in my security rules:
".write": "auth.joomlaRole === 'admin'"

Of course, it's also perfectly reasonable, and a bit more dynamic, to just synch those into my Firebase data and link them together with the users' ID. This is where the PHP lib would come into play:
".write": "root.child('roles/'+auth.joomlaId').val() === 'admin'"
Deciding which meets your needs is a proprietary judgement based on your preference and use case. We would need to understand a great deal more of your app to help here. But chances are, the more complex and dynamic the app becomes, the stronger use case you'll have for syncing the data in Firebase rather than just storing some meta in the token.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages