logo
Tags down

shadow

Firebase + Flutter - Cloud functions onCall result in "unauthenticated" error from Android app


By : mori yuvraj
Date : October 17 2020, 06:10 AM
hop of those help? The problem was using Node 10 when deploying to cloud functions.
Node 10 is currently in beta. Switched down to node 8 and it works fine:
code :
  "engines": {
    "node": "10"
  },
  "engines": {
    "node": "8"
  },


Share : facebook icon twitter icon

How to test `functions.https.onCall` firebase cloud functions locally?


By : avinash_chouhan
Date : March 29 2020, 07:55 AM
I hope this helps you . I can't seem to find the solution for this in the Firebase Documentation. , For locally you must call (after firebase.initializeApp)
code :
firebase.functions().useFunctionsEmulator('http://localhost:5000') 

Firebase + Cloud functions dynamic onCall


By : user1802914
Date : March 29 2020, 07:55 AM
it helps some times You can't use a callable function to deliver ongoing results. You must return a single set of results from onCall, then the function terminates. If you require more updates, you have to call the function again, but it's better if the client can use the Firebase SDKs to query the database directly and listen to the results as they change.

What is the proper way to get return value from Firebase Cloud Functions onCall method in Android?


By : user2864354
Date : March 29 2020, 07:55 AM
should help you out result.getData() is returning a Map type object, because you returned an object from the function. JavaScript objects become Java Maps. You just use it like you would any other Map.
code :
Map<String, Object> data = (Map<String, Object>) result.getData();
String message = (String) data.get("message");
boolean verified = (Boolean) data.get("verified");

How to catch cloud functions onCall functions.https.HttpsError by Flutter with cloud_functions package


By : Kevin Wu
Date : March 29 2020, 07:55 AM
wish helps you There is a call function implementation in Dart docs. If you take a look on it CloudFunctionsException is thrown only when exception property code == 'functionsError'.
With functions.https.HttpsError you are code from the first parameter( 'failed-precondition' in the example). Unfortunately HttpError has limited possible values of error codes and "functionsError" is not in the list.

Firebase Cloud Functions Call : error : Object message : "Bad Request" status : "INVALID_ARGUMENT"


By : Robert McCallum
Date : March 29 2020, 07:55 AM
To fix this issue in the end this was mostly json knowledge that missed me
my body should have data included
code :
exports.addAdminRole = functions.https.onCall((data, context) => {
    const dataParsed = JSON.parse(data);

    // get user
    return admin.auth().getUserByEmail(dataParsed.email).then(user => {
        // if not already (admin)
        if(user.customClaims && (user.customClaims).admin === true) {
            console.log(dataParsed.email + " is already an Admin");
            return;
        }
        // add custom claim (admin)
        return admin.auth().setCustomUserClaims(user.uid, {
            admin: true
        });
    }).then(() => {
        return {
            message: `Bravo : ${dataParsed.email} is now an Admin`
        }
    }).catch(err => {
        return err;
    });
});
function httpAddAdminRole(mail) {

    const initRequest = {
        method: 'POST',
        headers: {
            Accept: 'application/json',
            'Content-Type': 'application/json'
        },
        body:JSON.stringify({ 
            data:JSON.stringify({
                email: mail
            })
        })
    }

    console.log(initRequest);

    return fetch('https://us-central1-my-project.cloudfunctions.net/addAdminRole', initRequest)
      .catch(err => console.log(err))
      .then(res => res.json())
      .then(parsedRes => {
          console.log(parsedRes);
      });
}
Related Posts Related Posts :
  • How will the Toast be displayed, based on Activity/Fragment height and width (or) Device Screen width and height?
  • java.lang.IllegalStateException: Places must be initialized
  • How to implement GeckoView?
  • ARCore for older android devices
  • Could not resolve org.kodein.di:kodein-di-framework-android
  • Exoplayer playback error after interstitial ad
  • Custom lint rule for the `when condition` check
  • Is there a way to know when an app uses a permission in real time?
  • Unsupported Modules Detected: Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one pro
  • Android-studio 3.4.0-3.4.2 Gradle ERROR: No value has been specified for property 'manifestOutputDirectory'
  • Emulator not able to run on MacOs. Emulator claims that OS is out of date
  • How to start socket.io like foreground service to stay connected and listen for messages
  • How to display Snackbar above BottomNavigationView & move FAB?
  • how to prevent recyclerview auto scroll to bottom when insert new items?
  • React native - Make sure your bundle is packaged correctly or you're running a packager server release mode
  • UI doesn't update until tap on the screen when setState is called inside a realm listener callback
  • Android XML binding of MutableLiveData not working
  • How to make textinputedittext editable and uneditable programmatically
  • Can't load Kernel binary: Invalid kernel binary format version. No active package webdev
  • What is the use of {@url} in actions.xml app action URL templates?
  • How to implement device stored card(ios & android) to pay for application?
  • Is it good practice implementing Parcelable on a Room database entity?
  • What is the correct way of starting and stopping camera using CameraX?
  • Android: Add support for in-app updates in application
  • Can I record video with CameraX (Android Jetpack)?
  • Resources task gives error and appcompat-v7 is not loaded
  • Android CameraX doesn't show anything
  • XML constraint layout: Elements placed on top of each other, fix?
  • Flutter - dynamic height on a tab
  • With Scoped Storage introduced in Android Q, how am I supposed to develop a file manager app?
  • Can't resolve symbol android.support.v4.util.Pools in react-native-gesture-handler
  • Jetpack Compose: Could not set unknown property 'useIR'
  • SQLiteException: file is not a database while upgrading sqlcipher version from 3 to 4
  • What are best practices of implementing user login session in android application?
  • Button text not aligned center vertically in react native
  • "flutter (os error: no address associated with hostname, errno = 7)" only for android
  • How to catch platformException in flutter/dart?
  • Unable to connect to ADB
  • How can I test In-app updates in Android?
  • How to apply multiple generics in a function using Kotlin
  • Gradle DSL method not found: 'kapt()'
  • Android ADB: How to push multiple files, into an emulator?
  • How to run a multiple AND query with Android Room?
  • How do i fix the getting null location value from FusedLocationProviderClient in android
  • Which ad formats uses tinder?
  • How to perform delete api in retrofit
  • AWS AppSync Error - AWSMobileClientStore.get(String) on null object reference
  • How to make back button on WebView work in onBackPressed?
  • Circular reference error in firebase with R8
  • how can I move views on the right direction in constrainlayout
  • Send Intent From Activity To Fragment
  • findViewById with PhotoView library problem
  • Removing the bottom Padding from a TextView while using HTML Format
  • Defining resValue conditionally in build.gradle
  • Is there another solutions instead of nested Recyclerview
  • How to change textview text on cardview click?
  • App crash on opening document for some devices
  • How to fix Android compatibility warnings
  • Can't override android color resources
  • How add menu item's only for debug build type
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk