Firebase rule auth.token.email is not working: “Simulated write denied”

前端 未结 1 1204
庸人自扰
庸人自扰 2021-01-17 05:04

https://firebase.google.com/docs/reference/security/database/#authtokenF

{
  \"rules\": {
    \"c\":{
      \".write\":\"newData.child(\'email\').val()=== au         


        
1条回答
  •  梦毁少年i
    2021-01-17 05:13

    It looks like you're not providing an email address in the authentication data.

    When you select a provider, the simulator shows the exact auth.token payload that it will use. For the Google provider my Auth token payload looks like this:

    The simulator takes the literal JSON that is shown in here, and uses it as auth.token.

    {
      "provider": "google",
      "uid": "27e08474-4e33-460d-ba92-ba437c6aa962"
    }
    

    Since there is no email provided, your rules (correctly) fail.

    For testing this scenario, you'll want to switch to a custom provider, so that you can specify your own auth token with an email property:

    0 讨论(0)
提交回复
热议问题