0
votes

I am using the Firebase Functions Shell to interactively test a callable HTTPS function. The documentation (Test functions interactively) states that I can pass a Firebase-Instance-ID-token for authentication but doesn't say how to acquire one.

Optionally, you may pass in a Firebase-Instance-ID-token as the second parameter. This must be a string.

# invoke with Instance ID token
myCallableFunction('test data', {instanceIdToken: 'sample token'})

It also says,

Emulation of context.auth is currently unavailable.

Does this mean even if I pass a token my function will not receive context: { auth: uid }, etc? If so, what would be a good way to mock this for testing purposes?

FYI, I am not using Firebase Messaging.

1

1 Answers

0
votes

If you don't know exactly what you want there, then don't pass anything at all. If you're not using FCM, then the string will be useless to your function. It's only really used to in the API call to send messages, or to be stored for later use with FCM.

This token has nothing to do with user auth. FCM tokens don't identify an authenticated user. They identify a device that the user is using your app on.

I will point out also that the documentation states:

Emulation of context.auth is currently unavailable.

So there's nothing you can do to get context.auth populated in your function, from the perspective of this local testing tool.