diff --git a/lib/fcm.rb b/lib/fcm.rb index 6ea2962..4ef6d5c 100644 --- a/lib/fcm.rb +++ b/lib/fcm.rb @@ -320,11 +320,11 @@ def validate_condition_topics?(condition) def jwt_token scope = "https://www.googleapis.com/auth/firebase.messaging" - authorizer = Google::Auth::ServiceAccountCredentials.make_creds( + @authorizer ||= Google::Auth::ServiceAccountCredentials.make_creds( json_key_io: json_key, scope: scope, ) - token = authorizer.fetch_access_token! + token = @authorizer.fetch_access_token! token["access_token"] end