3

I get this error when trying to authenticate via Google using custom JWT tokens generated with Flask-restful and firebase-token-generator-python library. In short:

ref.authWithCustomToken(authData)

Error message:

INVALID_TOKEN: Failed to validate MAC.

I am using Angular 2.0.0-beta.2 / Ionic 2. The app is being tested on an android device using cordova-plugin-googleplus (with necessary credentials in Google Developer Console). I have recently enabled Cross-domain requests on nginx server. I can't find any documentation related to this error on Firebase or SO.

Any ideas?

4

2 回答 2

4

The problem was sending an Authentication Token to Firebase formatted as a JSON string via authData.toString() including delimiters and quotes. This must have thrown the Failed to validate MAC error, whatever that means.

于 2016-02-05T14:17:04.060 回答
2

I got the same error when using the incorrect key. I was using the apiKey provided right on the homepage in the Firebase Console while I should have been using the database secret key given at https://console.firebase.google.com/project/YOUR_PROJECT/settings/database.

于 2017-03-20T22:46:24.690 回答