Current issue on their Github.
First, I believe the Firebase documentation for how to use AppCheck with the Golang Admin SDK is wrong here. It says you need to create a new appcheck.Client
directly via method off of your firebase.App
, but this method doesn't exist (anymore?).
func main() {
app, err := firebaseAdmin.NewApp(context.Background(), nil)
if err != nil {
log.Fatalf("error initializing app: %v\n", err)
}
appCheck, err = app.AppCheck(context.Background()) // <-- here
if err != nil {
log.Fatalf("error initializing app: %v\n", err)
}
http.HandleFunc("/yourApiEndpoint", requireAppCheck(yourApiEndpointHandler))
log.Fatal(http.ListenAndServe(":8080", nil))
}
So, instead, I've referred to
Firebase's appcheck
package here which says you now need to create a new instance via this method instead:
func NewClient(ctx context.Context, conf *internal.AppCheckConfig) (*Client, error)
This, in theory, should work. However, note the use of an internal
module.
We can try using NewClient(...)
, and will be able to provide its first arg of context.Context
, but won't be able to provide a value for its second arg of type *internal.AppCheckConfig
because it's internal.
Does anyone have a fix for this? Or, perhaps, I'm overlooking the correct way to do this.
Thanks.