40 lines
645 B
Go
40 lines
645 B
Go
package backend
|
|
|
|
import (
|
|
"context"
|
|
|
|
firebase "firebase.google.com/go/v4"
|
|
"firebase.google.com/go/v4/auth"
|
|
"google.golang.org/api/option"
|
|
)
|
|
|
|
type Client struct {
|
|
*auth.Client
|
|
}
|
|
|
|
func NewApp() (*Client, error) {
|
|
var err error
|
|
client := new(Client)
|
|
|
|
ctx := context.Background()
|
|
opt := option.WithCredentialsFile("path/to/serviceAccountKey.json")
|
|
|
|
app, err := firebase.NewApp(ctx, nil, opt)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
client.Client, err = app.Auth(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return client, nil
|
|
}
|
|
|
|
func (c *Client) Verify(token string) (*auth.Token, error) {
|
|
ctx := context.Background()
|
|
|
|
return nil, nil
|
|
}
|