ember.jsember-dataemberfire

Authentication failed - Permission Denied with EmberFire


I'm trying to set up a basic datastore at firebase when following simple beginner tutorials on Ember js 2.0. For example I am following this tutorial:

https://medium.com/@jamesfuthey/a-gentle-introduction-to-ember-2-0-8ef1f378ee4#.d6umfj62j

I always seem to have a problem with authentication with the Firebase URL. That is, I've gotten to the bit where this tutorial tries to write information to my firebase project, but the Chrome Inspector shows I'm getting a 'permission denied' error from firebase.

FIREBASE WARNING: update at /posts/-KIpiNcp3WVRkCfwl_lW failed: permission_denied

I have installed emberfire with ember install emberfire. I have added my firebase URL to config/environment.js:

contentSecurityPolicy: { 'connect-src': "'self' HTTPREMOVED//auth.firebase.com wss://*.firebaseio.com" }, firebase: 'HTTPREMOVED//ember2-blog-ccb21.firebaseio.com',

Note: I had to remove the http element on these links to post here as I have a reputation less than 10.

Initially I did not change any authentication settings on my Firebase project (which I think is odd as I should need to authenticate to the Firebase project somehow). Then I tried adding my domains, firstly my IP and then the domain name associated with my IP.

I'm using: ember-cli: 2.5.1

I'd love it someone could point me in the right direction. Thank you.


Solution

  • Temporary insecure(!) approach with link to secure approach

    This will at least get you past the sticking point, but you need to undo it soon as you're done.

    In the Firebase console in your browser, go to Database -> Rules and replace the rules:

    {
      "rules": {
        ".read": "auth != null",
        ".write": "auth != null"
      }
    }
    

    with

    {
      "rules": {
        ".read": true,
        ".write": true"
      }
    }
    

    Which will allow you to get through that part of the tutorial.

    Warning: this allows anyone to write to your database, so reset the rules as soon as possible!

    More more details and a secure method, see this answer to the same Firebase access issue.