Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase 'createCustomToken' not recognized in Android

I'm implementing "login with custom token". I found this snippet of code in the Firebase documentation.

firebaseAuth.createCustomToken(uid)
                            .addOnSuccessListener(new OnSuccessListener<String>() {
                                @Override
                                public void onSuccess(String customToken) {
                                    // Send token back to client
                                }
                            });

I have put this code inside the 'onCreate' method and 'createCustomToken' is not being recognized: enter image description here

Any idea what I'm doing wrong? Thanks in advance!

like image 979
Patricia Avatar asked Dec 19 '25 16:12

Patricia


1 Answers

you try to mix up the Firebase Admin SDK with the Android SDK. The method createCustomToken is only available at the Admin SDK and not for the Android SDK. The docs for Android can be found here

https://firebase.google.com/docs/auth/android/start/

The Admin SDK can only be used at server side

like image 122
Michael Meyer Avatar answered Dec 22 '25 07:12

Michael Meyer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!