Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Cannot decode refreshToken using JWT #157

Closed
NordlingDev opened this issue Oct 8, 2016 · 3 comments
Closed

Cannot decode refreshToken using JWT #157

NordlingDev opened this issue Oct 8, 2016 · 3 comments
Labels

Comments

@NordlingDev
Copy link

NordlingDev commented Oct 8, 2016

When calling firebase.getCurrentUser(), it will leave a promise with the user info such as refreshToken. I am trying to decode this token using firebase/php-jwt, but am unable to do that using the given refresh token.

Uncaught exception 'UnexpectedValueException' with message 'Wrong number of segments'

The error comes from the JWT, but it seems like Firebase plugin is handing out an invalid token?

UPDATE: After translating this to JavaScript, I got a valid token. Which btw is a lot longer than the refreshToken:

var currentUser = FIRAuth.auth().currentUser;

currentUser.getTokenForcingRefreshCompletion(true, function(idToken, error) {
  if(error) {
    console.log(error);
  } else {
    console.log(idToken);
  }
});
@IvRRimum
Copy link

Is this on Android? How did you get the token in the first place?

@NordlingDev
Copy link
Author

@IvRRimum - Sorry, forgot to mention. This is iOS.

@EddyVerbruggen
Copy link
Owner

EddyVerbruggen commented Oct 10, 2016

There was a method called getAuthToken that provided this but I somehow managed to remove it by mixing up my remotes. It's back in 3.7.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants