laravel-notification-channels / fcm

Firebase Cloud Messaging (FCM) notifications channel for Laravel
https://laravel-notification-channels.com/
MIT License
495 stars 127 forks source link

Bug: Firebase Notification Channel POST https://oauth2.googleapis.com/token resulted in a 400 Bad Request` invalid JWT #90

Closed sts-ryan-holton closed 2 years ago

sts-ryan-holton commented 3 years ago

Hi, i've recently implemented the Laravel Firebase Notifications into my Laravel 8 project. It was working initially upon deployment after configuring my credentials, but now after the weekend I've got loads of failed jobs in my database (jobs are set up in my project to dispatch notifications through my channels) whereby the error is relating to an invalid grant for the token endpoint on Google?

I never configured any JWTs in the set up of the Laravel notification channel other than downloading a service account JSON file from Firebase and simply using JQ to put it into my env like this...

FIREBASE_CREDENTIALS='{"type":"service_account","project_id": ... }'
FIREBASE_DATABASE_URL=https://MYPROJECT-7aa08.firebaseio.com

How can i fix this error?

GuzzleHttp\Exception\ClientException: Client error: POST https://oauth2.googleapis.com/token resulted in a 400 Bad Request response: {"error":"invalid_grant","error_description":"Invalid JWT: Token must be a short-lived token (60 minutes) and in a reaso (truncated...) in /var/www/project-beacon-api/shared/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Stack trace:

My Default GCP resource location in Firebase is set to europe-west2

sts-ryan-holton commented 3 years ago

Update?

Prakort commented 2 years ago

@sts-ryan-holton have you tried using account-service.json instead of defining in .env?