firebase / firebase-admin-go

Firebase Admin Go SDK
Apache License 2.0
1.12k stars 239 forks source link

oauth2: cannot fetch token #515

Closed redloveling closed 1 year ago

redloveling commented 1 year ago

i get an err

unknown error while making an http call: Post "https://fcm.googleapis.com/v1/projects/ghgame001/messages:send": oauth2: cannot fetch token: Post "https://oauth2.googleapis.com/token"

my code ` ctx := context.Background() app, err := firebase.NewApp(ctx, nil) if err != nil { log.Fatalln(err) }

fcm, err := app.Messaging(ctx)
if err != nil {
    log.Fatalln(err)
}
token := "dVx1GC0taEhOo7om0EzZra:APA91bFyILOW0CFIYBjwIOAfg5AYlDQAowNbXfA4vDMQHOj3vnmhUETsNpup3NP2L_9JLSi4EmY_wiQYueaCWn3q2fgqeVq1iphq6l3frd06uQCKrswzUsdz1pl8rSTJykgOC_HgqIsE"

m := messaging.Message{
    Data: map[string]string{
        "temp":     "58.0F",
        "humidity": "47",
        "wind":     "18mph",
    },
    Token: token,
}
resp, err := fcm.SendDryRun(ctx, &m)
if err != nil {
    log.Fatalln(err)
}
log.Println("Message verified:", resp)`
google-oss-bot commented 1 year ago

I found a few problems with this issue:

lahirumaramba commented 1 year ago

Hi, our integration tests and nightly builds do not show any issues on this API. If you are still experiencing this issue please provide us with a minimal repro so we can take a look at it. Thanks!

redloveling commented 1 year ago

thanks, my local proxy is wrong