How to share Authentication token between app in Firebase 3.0?

1,256 views
Skip to first unread message

VU TIEP

unread,
May 20, 2016, 12:54:36 AM5/20/16
to Firebase Google Group

In older version of Firebase we can obtain authenticated token for sharing between our app, extensions.

But when upgrade to Firebase 3.0, that function doesn't work anymore. I've use getTokenWithCompletion: on FIRUser, then in my App Extension I call signInWithCustomToken:completion: with token i just obtained. But Firebase return an error with messgage:


Error Domain=FIRAuthErrorDomain Code=17000 "The custom token format is incorrect. Please check the documentation." UserInfo=0x799b6010 {error_name=ERROR_INVALID_CUSTOM_TOKEN, NSLocalizedDescription=The custom token format is incorrect. Please check the documentation.}

How to get authenticate token from FIRUser to re-authenticate it in my App Extension?

 

Frank van Puffelen

unread,
May 20, 2016, 12:56:24 AM5/20/16
to Firebase Google Group

Javier Leal

unread,
May 20, 2016, 10:20:18 AM5/20/16
to Firebase Google Group
Hello. I've same issue. Do you get any solution?

Dave Mulder

unread,
May 21, 2016, 8:49:30 AM5/21/16
to Firebase Google Group


On Friday, May 20, 2016 at 10:20:18 AM UTC-4, Javier Leal wrote:
Hello. I've same issue. Do you get any solution?


I'm not OP but I ran into this error on the JavaScript side of things.

For me, the answer was that I wasn't using RS256 encyryption when creating the token. A getting started page on custom auth told me to go to the Google Developers Console. After creating a new service account, dropping the private key into my app, and verifying that the JWT library was encrypting with RS256, Firebase is no longer giving me the "custom token format is incorrect" error.

I subsequently had to verify that I was including the right payload parameters when creating the token. 


Javier Leal

unread,
May 21, 2016, 11:27:53 AM5/21/16
to Firebase Google Group
Hello Dave. Did you setup {debug:true}, {admin:true} tokens when requesting the token in the new firebase version?

VU TIEP

unread,
May 23, 2016, 10:01:17 PM5/23/16
to Firebase Google Group
I'm not talking about custom token generated by server side.
I'm talking about token of Guest Authentication, Facebook Authentication... to share between app. 

Example in old version of Firebase with WatchOS:

Alfonso Gomez Jordana Manas

unread,
May 24, 2016, 12:05:14 PM5/24/16
to Firebase Google Group
Hello Vu, I replied on StackOverflow. Please continue the thread there.
Reply all
Reply to author
Forward
0 new messages