Error: INVALID_TOKEN: failed to parse authentication token

I am writing an e2e test protrans and in my test I am generating a firebase token which I pass as a request parameter in the url eg. browser.get ('/ login? token =' + token). When the test goes to the login page I am using firebase authwithcustomtoken to authenticate the user. eg.

Refs.rootRef.authWithCustomToken($location.search().token, function (err, authData) {
   console.log(err, authData);
});

      

Every time the code above is executed, I keep getting this error "Error: INVALID_TOKEN: Unable to parse authentication token". This is the code I am using to generate the token in node.js before passing it to the browser as a request the string:

var secret = 'XXXXXXX';
var tokenGenerator = new FirebaseTokenGenerator(secret);
var token = tokenGenerator.createToken(
  {
    uid: 'google:uid', 
    email: 'xxx.xxx@xxx.co'
  }
);

      

Before I started using the firebasetokengenerator node package, I used to generate a token on this site http://jsfiddle.net/katowulf/D4YL8/light/ . I would then test on this site to see that firebase authenticates the token I just created and it always works, but as soon as I use the token in my test I get an error, cannot parse the authentication token. Then I tried using the firebasetokengenerator node module and I still get the same error message. I do not know what's the problem.

I would appreciate it if someone could help me with this. Thanks to

+3


source to share





All Articles