-
Notifications
You must be signed in to change notification settings - Fork 268
Closed
Description
I try to set the base url for the client library so that during testing I can run requests against a FCM mock instead of doing internet requests. However, even with the following code, I can see the attempts to reach the official base url:
ctx := context.Background()
opts := []option.ClientOption{option.WithEndpoint("http://localhost:1234/")}
// opts = append(opts, option.WithoutAuthentication())
app, _ := firebase.NewApp(ctx, nil, opts...)
c, _ := firebaseApp.Messaging(ctx)
_, _ = c.Send(cox, nil)
POST /v1/projects/dummy-project-id/messages:send HTTP/1.1
Host: fcm.googleapis.com
User-Agent: Go-http-client/1.1
Content-Length: 71
Content-Type: application/json
Accept-Encoding: gzip
{"message":{"notification":{"title":"foo","body":"bar"},"token":"123"}}
HTTP/2.0 401 Unauthorized
Alt-Svc: quic=":443"; ma=2592000; v="44,43,39,35"
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Mon, 05 Nov 2018 18:37:10 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
helielson