Firebase is not defined - javascript

I'm a newbie with firebase and want to set up a simple login module for a website. I set up a page with a form and two fields:
1. Mailaddress
2. Password
When the login is authenticated I like to direct to a another page.
I have two questions:
Question 1.: When I look in my source code I see the error message: "Uncaught ReferenceError: Firebase is not defined"
I checked the url in my dashboard of Firebase and it is correct. Is there something I am doing wrong.
Quesion 2.: I have looked for a login exmple with firebase, but I only could find an example build with the old deprecated version of Firebase (which I am trying to use in my example).
Hope somebody can give me some leads or tips. Would be very gratefull.
Thnks!
Kenneth

As Marein remarked in his comment, don't waste your time trying to learn about a platform on an older version. It's simply not worth the hassle and it'll be almost drastically reduce our ability to help you.
That said:
You're only including the simple-login script, which used to be separate from Firebase's regular JavaScript SDK. So the error message signals that you also have to include the regular SDK. For today's Firebase, if you go to the front page of Firebase's documentation for the JavaScript SDK, you'll find that the JavaScript SDK can be found at https://cdn.firebase.com/js/client/2.2.4/firebase.js. This latest SDK includes both the core Firebase functionality and the login functionality. So if you just replace your current included script with this one, you'll be good to go
Now that you've included the current version, you can find example of authentication on this page: https://www.firebase.com/docs/web/guide/user-auth.html

Related

ApostropheCMS Deployment Issue With Widget

I am a relative beginner to working in Apostrophe. I'd like to start off by saying its a pretty great ecosystem and I've enjoyed the experience so far. However, I've run into an issue thats a bit confusing.
I've been using it to build a site for a client and I've run into a very odd issue. I have installed an instagram widget that I found via npm (https://www.npmjs.com/package/#kwsites/cms-instagram-widgets) and used it on my local host with relatively no issues, it worked and I moved on with my life.
However now I'm trying to deploy the site and the Instagram widget is not showing up in the browser when viewing on the server. Again the widget shows up perfectly fine in the browser when viewing off my local host which would indicate it did not install correctly on the server but after following all of the post install steps on the linked npm package, I am completely unsure of what to try next.
I have confirmed that the #kwsites package folder is in public/modules/ directory
Any help/tips from any of the Apostrophe experts out there would be appreciated.
I am using stagecoach for deployment (again, a great product) and mechanic to manage nginx. I don't know if any of this matters but the widget is making some API calls to Instagram, don't know if they would be affected by either of those tools.
EDIT: Inspection in safari yielded the following from my local host
And the following from my server
It just looks like the widget is not being generated and I cannot find any errors in the console. Note I can add and remove a widget, I just can't get any content to generate on the server (but can on local host).
So as noted in the comments, I believe the issue was due to instagram's legacy api requiring site authorization. However with Facebook pushing the new Instagam Basic Display API, the legacy is going to be killed at the end of this month anyway/apps will stop working. So I found this blog post and found it easily adaptable to an Apostrophe module. It requires signing up for Zapier but a basic account is free and its a really interesting tool. This solved my needs

Can I use Firebase with Squarespace?

I've built a website from the ground up already but for an upcoming one I need to use Wix or Squarespace as well as Firebase. So I set about trying to figure out if I could mesh those platforms when I came across the answer to this question:
Can I store database information in Squarespace? A: Essentially no
Followed by this documentation from Squarespace FAQs.
I was a bit confused since Firebase uses Javascript to use Auth, Firestore, Functions etc. Even if you need to run server-side code you can make a call to Firebase via JS to run Node applications. So is it possible to use Firebase with Squarespace, if you're allowed to add custom JS to your site?
Yes, Firebase works fully client-side. The only backend code you write in Firebase you can deploy directly to Firebase.
You can follow the official JavaScript web guide for Firebase to get started with this.

Deploying the transactions on google webhook sample on dialogflow inline editor

I'm making a project on dialogflow / actions on google that has multi functionality outside of just transactions of physical products. I'm currently following the tutorial provided by google (I'll post the link below).
I'm just wondering if this is possible to deploy to the inline editor and it will work the same? Only reason I am asking is because in the tutorial they are using the firebase CLI and using a url for a webhook (Which I've seen them use in other tutorials, but I have always just used the inline editor and it's worked fine).I have tried already deploying to the inline editor and I got an error, although that could have just been me doing something wrong.
Just curious if anyone has done a similar project using the inline editor and it's worked?
Thanks for the help!
Github link here
Actions on Google link here
I would try to answer your questions below:
If this is possible to deploy to the inline editor and it will work
the same?
Yes. It would work the same in the Inline Editor ( because it is powered by Cloud Functions for Firebase ) as long as you handle
responses for all the intents required for your transactions.
But I would like to emphasize on following limitations using the Inline Editor for fulfillment:
The inline editor only supports two files: index.js and package.json (modifying package.json will install any dependencies you
specify upon deployment). Hence, It becomes difficult to keep the code
modularized using the inline editor.
You cannot save or download code modified in the inline editor without first deploying. Hence, It becomes difficult to debug your
intents before deploying.
So, I would recommend using the Webhook Fulfillment i.e setting up your local development environment and then using Firebase CLI to deploy your code to Firebase Functions.
I would recommend completing this codelab and then following the instructions in the Github link and Actions on Google links you mentioned in the question to complete setting up transactions in Actions on Google.
Good Luck!
Hope that helps!
Just an FYI for anyone wanting to use the inline editor on dialogflow, as the above answer stated, you can use the inline editor and it works fine. Just make sure you don't test it on the simulator on the actions on google console or else it won't work. Make sure it's on a smart speaker or a phone.

IOAuth.IO Integration with Ionic/Angular Hybrid App

I am having a really difficult time getting the cordova plugin authored by OAuth.io (https://github.com/oauth-io/oauth-phonegap) to work within the an ionic phone build. Everything is setup based off of the desktop version of the JS file they provide, wrapped in an Angular service for ease of unit testing, with another factory handling the actual flow of login/logout etc...
The issue I am running into is that now after switching to the plugin version and removing the referenced JS version, nothing works any longer. I can no longer pull up the facebook login page, nor have the global object 'OAuth' recognized outside of the injected service. The furthest I got in troubleshooting the issue is that the OAuth object is created, at least initially as I can log out the object, but anything after that does not appear to be recognized.
My web (working) version of code example is on plunker here: http://plnkr.co/edit/B4HdkkBKDP3Xv2riQGui?p=preview
Any thoughts on further troubleshooting or if there is another way of accomplishing this goal would be greatly appreciated!
We just published the version 0.2.0 of the OAuth.io Cordova/Phonegap SDK, which fixes the issue with Ionic.
Now you should be able to use the cordova plugin in a ionic app without any trouble, like this:
$ cordova plugin add https://github.com/oauth-io/oauth-phonegap
This version also contains features that were missing from the sdk, like the cache and the unified user info method.
You can get more information about all this on our github page:
https://github.com/oauth-io/oauth-phonegap
Hope this helps :)

Meteor JS - Collections (mongodb) can be changed by any visitor (Not secure)

I am using the Meteor JS node framework for a project I am working on.
I noticed that anyone visiting my website can simply enter a similar command into the javascript console in their browser and edit my database.
MyCollection.insert({name: 'I am a hacker', message: 'hahaha'});
Is there any way to stop users from being able to do this?
This is really not secure, all they need to do is find the name of the Collection and they can do anything they want.
How can I fix this problem?
Should I use a different framework, is Meteor JS not ideal for a large-scale project?
Thanks,
Jonathan.
You would do best to read their docs, specifically http://docs.meteor.com/#dataandsecurity

Categories