Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "context"
- "encoding/json"
- "fmt"
- "os"
- "path"
- "firebase.google.com/go"
- "google.golang.org/api/option"
- )
- func main() {
- app, err := firebase.NewApp(context.Background(), &firebase.Config{
- ProjectID: "<PROJECT_ID>",
- }, option.WithCredentialsFile("<CREDENTIAL_FILE_PATH>"))
- if err != nil {
- panic(err)
- }
- cli, err := app.Auth(context.Background())
- if err != nil {
- panic(err)
- }
- rec, err := cli.GetUser(context.Background(), "<UID>")
- if err != nil {
- panic(err)
- }
- recJSON, err := json.MarshalIndent(rec, "", " ")
- if err != nil {
- panic(err)
- }
- fmt.Printf("%s\n", recJSON)
- if err := cli.SetCustomUserClaims(context.Background(), "<UID>", map[string]interface{}{
- "this is sample": "hogehoge fugafuga",
- }); err != nil {
- panic(err)
- }
- }
Add Comment
Please, Sign In to add comment