Guide

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

Terminal with programming code used to run gcloud auth print-access-token
OAuth tokens from gcloud authorize your HTTP v1 requests to FCM

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

Command-line terminal showing code for Google Cloud SDK authentication
Run gcloud auth print-access-token after signing in to the correct project
  1. Run gcloud auth login and sign in with a Google account that has access to the Firebase project
  2. Run gcloud auth application-default login for application default credentials
  3. Run gcloud auth print-access-token and copy the entire output
  4. Paste into TestFCM Access Token field within the token lifetime (typically 1 hour)
gcloud auth print-access-token

Common 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

Guide photos from Unsplash & Pexels (free license)