Authentication failed - Permission Denied with EmberFire

非 Y 不嫁゛ 提交于 2020-01-14 01:47:03

问题


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.


回答1:


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.




回答2:


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

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

To:

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

The above worked for me, it is baiscally the same as previous answer, however I kept the auth keyword so when i'm ready to secure the database the basic syntax is already there.



来源:https://stackoverflow.com/questions/37495397/authentication-failed-permission-denied-with-emberfire

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!