firebase / quickstart-java

Quickstart samples for Firebase Java Admin SDK
Apache License 2.0
234 stars 143 forks source link

Authentication failed: invalid_token #3

Closed winstonma closed 8 years ago

winstonma commented 8 years ago

I created a Firebase project and downloaded this repo, created service-account.json.

In addition in the Database.java I added some sample code from the Firebase QuickStart Guide - Save Data to store some data. However I got the following error [WARN] PersistentConnection: pc_0 - Authentication failed: invalid_token (Access denied.)

Here is my database rules.

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

It should allows any read/write.

I have no idea how to get the auth done. Thanks for the help

winstonma commented 8 years ago

Seem using firebase-server-sdk 3.0.1 solve the problem

winstonma commented 8 years ago

Is it possible to update the SDK in the sample?

Thanks

samtstern commented 8 years ago

@winstonma done!

winstonma commented 8 years ago

Thanks

This is the solution I found in Stackoverflow.

Although your sample code have no problem. Some people (like me) would use your code a reference and expand their work. It would be great if any other developer didn't face the same problem and spend time searching stackoverflow.

samtstern commented 8 years ago

@winstonma totally agree, this one is my fault for not upgrading the sample dependency version as soon as 3.0.1 was released.