How to Get an OAuth Access Token for FCM
Step-by-step instructions to generate a valid ya29 OAuth token using Google Cloud SDK for FCM HTTP v1 API calls.
Last updated: May 2026

Install Google Cloud SDK
Download and install the Google Cloud SDK for your OS from cloud.google.com/sdk. After installation, run gcloud init and select the Firebase-linked Google Cloud project.
Authenticate

- Run gcloud auth login and sign in with a Google account that has access to the Firebase project
- Run gcloud auth application-default login for application default credentials
- Run gcloud auth print-access-token and copy the entire output
- Paste into TestFCM Access Token field within the token lifetime (typically 1 hour)
gcloud auth print-access-tokenCommon mistakes
- Using the FCM device token (APA91…) instead of OAuth token
- Using an expired token — generate a fresh one if you see 401 UNAUTHENTICATED
- Wrong Google Cloud project selected in gcloud config
- Account lacks permission to send FCM messages
Continue with our complete testing guide or open the FCM tester to send a notification now.
Ready to test? Open the FCM tester · Browse all guides