Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
- [added] The Admin SDK can now read the Firebase/GCP project ID from
both `GCLOUD_PROJECT` and `GOOGLE_CLOUD_PROJECT` environment
variables.
- [fixed] Using the default, unauthorized HTTP client to retrieve
public keys when verifying ID tokens.

# v3.1.0

Expand Down
3 changes: 2 additions & 1 deletion auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"encoding/json"
"errors"
"fmt"
"net/http"
"strings"

"golang.org/x/net/context"
Expand Down Expand Up @@ -128,7 +129,7 @@ func NewClient(ctx context.Context, conf *internal.AuthConfig) (*Client, error)

return &Client{
is: is,
keySource: newHTTPKeySource(idTokenCertURL, hc),
keySource: newHTTPKeySource(idTokenCertURL, http.DefaultClient),
projectID: conf.ProjectID,
signer: signer,
version: "Go/Admin/" + conf.Version,
Expand Down
4 changes: 4 additions & 0 deletions auth/token_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"encoding/json"
"encoding/pem"
"errors"
"fmt"
"io/ioutil"
"net/http"
"strconv"
Expand Down Expand Up @@ -98,6 +99,9 @@ func (k *httpKeySource) refreshKeys(ctx context.Context) error {
if err != nil {
return err
}
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("invalid response (%d) while retrieving public keys: %s", resp.StatusCode, string(contents))
}
newKeys, err := parsePublicKeys(contents)
if err != nil {
return err
Expand Down