question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ANDROID-BUG] Getting firebase token?

See original GitHub issue

How can i get the auth token from:

 57     this.ngZone.run(() => {
 58       firebase.getCurrentUser().then((data) => {
 59         this.currentUserId.next(data.uid);
 60       });
 61     });

I need the token, so i can send it to my backend and upload resized photos to firebase. Is there a better way to do this?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
EddyVerbruggencommented, Oct 7, 2016

The problem was getToken is nowgetToken(forceRefresh:boolean), so that explains the error (the signature is incorrect).

The GitHub version now has a new getAuthToken:

firebase.getAuthToken({
  forceRefresh: false
}).then(
  function (token) {
    console.log("Auth token retrieved: " + token);
  },
  function (errorMessage) {
    console.log("Auth token retrieval error: " + errorMessage);
  }
);

Please give it a spin and I’ll soon publish to npm as well.

0reactions
mnuckolscommented, Mar 26, 2017

I’m using the Facebook login on an Android emulator. When I call firebase.getAuthToken() it always returns the uid as the token instead of a JWT. Is that how it’s supposed to work? How can I get a JWT to authenticate the user in my own web services?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set up a Firebase Cloud Messaging client app on Android
Retrieve the current registration token; Monitor token generation ... This is required if you want to do any message handling beyond receiving notifications ......
Read more >
Crash on Request Notification Permissions - Android - Bug
I'm trying to get Push notification working with OneSignal. All is good on iOS. On Android I can get device token added to...
Read more >
Firebase (FCM) how to get token - android - Stack Overflow
This line should get you the firebase FCM token. String token = FirebaseInstanceId.getInstance().getToken(); Log.d("MYTAG", "This is your Firebase token" + ...
Read more >
Android: Firebase Credentials - OneSignal Documentation
Directions on how to generate a Firebase Server API key for sending Android App Notifications. ... Getting Your Firebase Cloud Messaging Token And...
Read more >
Get fcm token in android firebase. Firebase cloud ... - YouTube
Get fcm token in android firebase. Firebase cloud messaging in android studioDo you want to connect with lot of DEVELOPERSjoin ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found