google / identity-toolkit-go-client Goto Github PK
View Code? Open in Web Editor NEWGoogle identity Toolkit client library for Go
License: Apache License 2.0
Google identity Toolkit client library for Go
License: Apache License 2.0
When I change the order (first call UserByEmail then ListUsers), everything works fine.
package main
import (
"fmt"
"github.com/google/identity-toolkit-go-client/gitkit"
"golang.org/x/net/context"
)
func main() {
fmt.Println("staring...")
config := &gitkit.Config{
WidgetURL: "http://localhost/gitkit",
CookieName: "gtoken",
GoogleAppCredentialsPath: "/home/orian/tmp/google-identity-toolkit/validation/project-service-account.json",
}
client, err := gitkit.New(context.Background(), config)
if err != nil {
fmt.Printf("some problem: %s", err)
return
}
fmt.Println("users")
ul := client.ListUsers(context.Background())
if ul.Error != nil {
fmt.Printf("Err: %s", ul.Error)
return
}
for u := range ul.C {
fmt.Println(u.Email)
}
fmt.Println("a specific user")
u,err := client.UserByEmail(context.Background(), "[email protected]")
if err != nil {
fmt.Printf("err getting user: %s\n", err)
return
}else {
fmt.Printf("got user: %s\n", u.DisplayName)
}
fmt.Println("...ending")
}
panic: close of closed channel
goroutine 5 [running]:
github.com/google/identity-toolkit-go-client/gitkit.(*UserList).start.func1(0xc820011680, 0x7fe077c68668, 0xc82000ad80, 0xc8200222a0)
/gopath/src/github.com/google/identity-toolkit-go-client/gitkit/gitkit.go:243 +0x217
created by github.com/google/identity-toolkit-go-client/gitkit.(*UserList).start
/gopath/src/github.com/google/identity-toolkit-go-client/gitkit/gitkit.go:251 +0x8c
Currently, the claims parsed from the ID Token are restricted to a specific set of hardcoded values. I'm working on a project where I would like to have support for the hd
hosted domain claim as documented in Use Google Sign-In with IT Apps.
I think the simplest way to implement this would be to just add a field to the deserialization and Token
struct. A more general approach could use an Extra()
method similar to that on the golang.org/x/oauth2.Token
type. In addition to deserializing the claims here, a map could be created and stored in a private raw
field, just as oauth2 does.
I'm happy to submit a PR for either (or both) of these routes.
I want to use Sourcegraph for identity-toolkit-go-client code search, browsing, and usage examples. Can an admin enable Sourcegraph for this repository? Just go to https://sourcegraph.com/github.com/google/identity-toolkit-go-client. (It should only take 30 seconds.)
Thank you!
At the moment only 1.4 and 1.5 are tested.
The documentation says:
ctx := appengine.NewContext(r)
c, err := gitkit.NewWithContext(ctx, client)
But gitkit.NewWithContext requires a context.Context
not an appengine.Context
But even with suppying a context.Context does make it work.
The switch to google.golang.org/appengine means that app engine projects can be be built using the standard go tools, this is useful as goapp dosn't work well with oracle, gocode etc.
The issue is there is no NewWithContext function on the non appengine build. If this was added GitKit could could be used in app engine projects and use the go tools.
My eyes do not function as well as yours. So please add syntax highlight to every Go's code samples across Go projects. Very thankful for this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.