Cloud Functions FCM Expected OAuth 2 access token

2019-08-05 08:12发布

So since 29 July I noticed that my Firebase Cloud Functions throws error when trying to send FCM messages.

Error: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential

Can't find anything specific to this except for the Admin SDK https://firebase.google.com/docs/cloud-messaging/admin/send-messages but as far as I understood that kind of setup (configuring with a serviceAccount) isn't required on Cloud Functions, correct?

Any ideas how to fix this?

I followed the example https://github.com/firebase/functions-samples/tree/master/fcm-notifications to set it up, it worked up until the first error on 29 July 2018.

My current instantiation looks like this:

'use strict'

const admin = require('firebase-admin')
const functions = require('firebase-functions')
const cors = require('cors')({origin: true})
const config = functions.config()

admin.initializeApp(config.firebase)

const db = admin.firestore()
const messaging = admin.messaging()

0条回答
登录 后发表回答