Custom Authentication using Firebase results in FirebaseException: An internal error has occurred. [ MISSING_IDENTIFIER ]

1,084 views
Skip to first unread message

Rahul Sainani

unread,
Nov 15, 2016, 11:03:48 AM11/15/16
to Firebase Google Group
I'm trying to setup custom authentication in my Android app using Firebase. I'm generating Json Web Token on the server and passing it to the client. So when I use the custom token on android with signInWithCustomToken I get this error: 

FirebaseException: An internal error has occurred. [ MISSING_IDENTIFIER ]

I generated the private key on the Firebase Console and I'm using a Java JWT library to generate the token on the server. All the credentials (issuer, subject, audience) are correct and if I use the incorrect ones, it throws FirebaseAuthInvalidCredentialsException.

So what seems to be the issue here? I've been stuck on this for a long time. Does anyone know?

The reason I'm not using FirebaseAdminSDK is because it uses Java8 and I can't seem to comprehend how to deploy on AppEngine with Java8, so I'm using Java 7 App Engine SE.

Jacob Wenger

unread,
Nov 15, 2016, 12:37:19 PM11/15/16
to fireba...@googlegroups.com
Hey Rahul,

That error means your token is invalid in some way. I would strongly suggest you use the Firebase Admin Java SDK to handle all of this for you. The docs for minting custom tokens with that SDK are here. I know that versions 4.0.0 and 4.0.1 have a known issue where they do not run on Java 7, but that should be fixed very soon with a 4.0.2 release.

If you need something immediately, I would suggest dropping down to the version 3.0.3 of firebase-server-sdk, which does work on Java 7. Just note that, as stated in our release notes, the createCustomToken() method in that version is synchronous.

If you'd rather use your custom JWT library, I would suggest inspecting your token with https://jwt.io. Make sure all the fields mentioned in these docs match your custom token. If you can't figure it out, feel free to post the payload contents of your token here and I can take a look.

I can't provide an exact release date for the 4.0.2 release, but do note that it is a top priority and should be out very soon.

Cheers,
Jacob

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/bfa331c5-6d10-45d0-a811-c230522ae5f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rahul Sainani

unread,
Nov 16, 2016, 8:09:24 AM11/16/16
to Firebase Google Group
Hi Jacob,

Thanks for replying so quickly. Turns out admin sdk 4.0.2 is out and I'm using that now to create the token and it works. Great timing! :)

Thanks for the suggestion to inspect the token on jwt.io, never thought of that, I will do that since it bothered me so much and I still don't know why that didn't work.

Cheers!
Rahul
Reply all
Reply to author
Forward
0 new messages