401 Unauthorized, Request is missing required authentication credential. Expected OAuth 2
kinocalde opened this issue · comments
PushNotification::setService('fcm')
->setMessage([
'notification' => [
'title'=>'title',
'body'=>'hello w',
'sound' => 'default'
]
])
->setDevicesToken($devices)
->send()
->getFeedback();
Error:
{"success":false,"error":"Client error: POST https:\/\/fcm.googleapis.com\/v1\/projects\/************\/messages:send
resulted in a 401 Unauthorized
response:\n{\n "error": {\n "code": 401,\n "message": "Request is missing required authentication credential. Expected OAuth 2 (truncated...)\n"}
According to firebase "All HTTP requests to API v1 must be authorized with an access token OAuth 2.0"
and to obtain said token I must generate a file of private keys in JSON format and use that key to recover said access token of OAuth 2.0 of short duration. I already have the JSON file obtained in my firebase, but I must now have said OAuth 2.0 access token and I do not know if I can do this in any way in this package ... Any idea?
Hi @kinocalde ,
Have you set the apiKey
for fcm in the config file?
Yes