
⇒ 본 가이드는 맥os에서 fcm푸시발신 테스트를 진행하는 과정에 대한 가이드임.
⇒ 파이썬을 사용해 엑세스토큰을 발급받는다.
import google.auth.transport.requests
import google.oauth2.service_account
# fcm admin JSON 키 파일 다운로드 필요
SERVICE_ACCOUNT_FILE = 'adminsdk.json' # 실제 파일/경로 설정
# 서비스 계정으로 JWT 자격 증명 생성
credentials = google.oauth2.service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE,scopes=['<https://www.googleapis.com/auth/firebase.messaging>'])
# 엑세스 토큰 발급
auth_req = google.auth.transport.requests.Request()
credentials.refresh(auth_req)
# 발급된 엑세스 토큰 출력
print(credentials.token)
brew install python
python3 --version