Skip to content

Commit

Permalink
Merge pull request #103 from rkyrychuk/master
Browse files Browse the repository at this point in the history
Cache authorizer to avoid IO end
  • Loading branch information
sabman authored Apr 2, 2022
2 parents a296342 + 03334b8 commit 51212f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fcm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 51212f2

Please sign in to comment.