firebase / quickstart-java

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

[WARN] PersistentConnection: pc_0 - Auth token revoked: expired_token (Auth token is expired.) #6

Closed pejas closed 7 years ago

pejas commented 8 years ago

My application logs this line from time to time with log level WARN. As described in #5 this is expected behaviour, application recovers and works fine.

Please change log level for this message to DEBUG (or at least INFO).

WARN alerts admins and they involve devs to investigate which is unnecessary.

If created this issue in wrong project please point me to right one.

Best Regards

samtstern commented 8 years ago

@mikelehen can you comment on why this is WARN and not DEBUG or INFO. Seems like a reasonable concern.

mikelehen commented 8 years ago

Yeah. I believe a fix for this is in the works, but not sure when it'll be released. cc/ @schmidt-sebastian

tannerhallman commented 7 years ago

Still having this issue. Any updates on the fix?

mikelehen commented 7 years ago

Hrm. I thought this got fixed. What version of which SDK (firebase or firebase-admin) are you using?

mikelehen commented 7 years ago

Er, woops. Since this is the quickstart-java repo, I'll assume it's the java server sdk.

tannerhallman commented 7 years ago

Yes it is the java server sdk.

<dependency>
  <groupId>com.google.firebase</groupId>
  <artifactId>firebase-server-sdk</artifactId>
  <version>3.0.1</version>
</dependency>

Just realized that I don't have the most recent version. Rip fam.

Is this what I need?

<dependency>
  <groupId>com.google.firebase</groupId>
  <artifactId>firebase-admin</artifactId>
  <version>4.1.1</version>
</dependency>

EDIT: I have resolved this issue by upgrading to the latest SDK and using the new initialize methods. Cheers!

FileInputStream refreshToken = new FileInputStream("./firebase-admin.json");
        FirebaseOptions options = new FirebaseOptions.Builder()
                .setCredential(FirebaseCredentials.fromRefreshToken(refreshToken))
                .setDatabaseUrl(databaseUrl)
                .build();
        FirebaseApp.initializeApp(options);
mikelehen commented 7 years ago

Yep, that's exactly what you need. It looks like this quickstart is out of date! Glad to hear the new SDK solved the problem.

samtstern commented 7 years ago

Fixed by #8