Skip to content

coldwireorg/cwhydra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CW-Hydra

Ory Hydra client for coldwire's purposes

go get codeberg.org/coldwire/cwhydra

Exemple

// Initialize API
api := cwhydra.New(cwhydra.Config{
  Url: "http://127.0.0.1:4445", // Admin Endpoint
  Http: http.Client{
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		},
		Timeout: 0,
	},
})

log.Println("Creating a client named 'test'")
create, err := cwhydra.ClientManager(api).Create(cwhydra.OAuth2Client{
	ClientName: "test",
})
if err != nil {
	t.Error(err)
}

log.Println("> The client id is:", create.ClientId)

log.Println("Getting the created client")
g, err := cwhydra.ClientManager(api).Get(create.ClientId)
if err != nil {
	t.Error(err)
}

log.Println(">", "Name of the client:", g.ClientName)

log.Println("List all clients")
clients, err := cwhydra.ClientManager(api).List()
if err != nil {
	t.Error(err)
}

for i, v := range clients {
	log.Println(">", i, v.ClientId)
}

log.Println("Deleting client:", create.ClientId)
err = cwhydra.ClientManager(api).Delete(create.ClientId)
if err != nil {
	t.Error(err)
}

About

A Go library for Ory Hydra Admin API, mirror: https://codeberg.org/coldwire/cwhydra

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages