Use Type() method for OAuth tokens instead of accessing TokenType field. (#1537)

This covers the case where the TokenType field is empty, and thus
calling the Type() method will return "Bearer".
This commit is contained in:
Sean Harger
2017-09-25 11:38:05 -07:00
committed by dfawley
parent d4b75ebd4f
commit 956d689a24
2 changed files with 4 additions and 4 deletions

View File

@ -80,7 +80,7 @@ func (j jwtAccess) GetRequestMetadata(ctx context.Context, uri ...string) (map[s
return nil, err
}
return map[string]string{
"authorization": token.TokenType + " " + token.AccessToken,
"authorization": token.Type() + " " + token.AccessToken,
}, nil
}
@ -100,7 +100,7 @@ func NewOauthAccess(token *oauth2.Token) credentials.PerRPCCredentials {
func (oa oauthAccess) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
return map[string]string{
"authorization": oa.token.TokenType + " " + oa.token.AccessToken,
"authorization": oa.token.Type() + " " + oa.token.AccessToken,
}, nil
}
@ -134,7 +134,7 @@ func (s *serviceAccount) GetRequestMetadata(ctx context.Context, uri ...string)
}
}
return map[string]string{
"authorization": s.t.TokenType + " " + s.t.AccessToken,
"authorization": s.t.Type() + " " + s.t.AccessToken,
}, nil
}