title: How to pass arguments from Dart to Cloud functions written in Typescript and it also gives me error code UNAUTHENTICATED
body: <p>Dart function (passing <code>token</code> to <code>sendToDevice</code>):</p>
  
  <pre><code>Future&lt;void&gt; _sendNotification() async {
    CloudFunctions functions = CloudFunctions.instance;
    HttpsCallable callable = functions.getHttpsCallable(functionName: "sendToDevice");
  
    callable.call({
      'token': await FirebaseMessaging().getToken(),
    });
  }
  </code></pre>
  
  <p><code>index.ts</code> file where I have defined <code>sendToDevice</code> method. </p>
  
  <pre><code>import * as functions from 'firebase-functions';
  import * as admin from 'firebase-admin';
  admin.initializeApp();
  
  const fcm = admin.messaging();
  
  export const sendToDevice = functions.firestore
    .document('users/uid')
    .onCreate(async snapshot =&gt; {
  
      const payload: admin.messaging.MessagingPayload = {
        notification: {
          title: 'Dummy title',
          body: `Dummy body`,
          click_action: 'FLUTTER_NOTIFICATION_CLICK'
        }
      };
  
      return fcm.sendToDevice(tokens, payload); // how to get tokens here passed from above function?
    }
  );
  </code></pre>
  
  <hr>
  
  <p>Questions:</p>
  
  <ol>
  <li><p>How can I receive tokens passed from my Dart function <code>_sendNotification</code> to Typescript's <code>sendToDevice</code> function. </p></li>
  <li><p>When I was directly passing tokens inside <code>index.ts</code> file, I was getting this exception:</p></li>
  </ol>
  
  <blockquote>
    <p>[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(functionsError, Cloud function failed with exception., {code: UNAUTHENTICATED, details: null, message: UNAUTHENTICATED})</p>
  </blockquote>
  
  <p>Can anyone please explain if I am supposed to authenticate something here? The command <code>firebase login</code> shows I am already signed in. I am very new to Typescript so please bear with these stupid questions. </p>