Skip to content

Commit

Permalink
supply kid and fix variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
godfat committed Jun 3, 2016
1 parent 5d65d26 commit 6bd154b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/rest-firebase.rb
Expand Up @@ -63,7 +63,7 @@ def sign input
class RestFirebase::Client3 < RestFirebaseBase
AUD = 'https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit'

attr_accessor :claims, :private_key, :service_account, :uid
attr_accessor :claims, :private_key, :service_account, :uid, :kid

def generate_auth opts={}
raise Error::ClientError.new("Please set your private_key") unless
Expand All @@ -72,11 +72,11 @@ def generate_auth opts={}
service_account

self.iat = nil
header = {:typ => 'JWT', :alg => 'RS256'}
claims = {:iss => service_account, :sub => service_account,
:aud => AUD, :iat => iat, :claims => claims,
:exp => iat + 3600, :uid => :uid}.merge(opts)
generate_jwt(header, claims)
jwt_header = {:typ => 'JWT', :alg => 'RS256', :kid => kid}
jwt_claims = {:iss => service_account, :sub => service_account,
:aud => AUD, :iat => iat, :claims => claims,
:exp => iat + 3600, :uid => uid}.merge(opts)
generate_jwt(jwt_header, jwt_claims)
end

def sign input
Expand Down

0 comments on commit 6bd154b

Please sign in to comment.