func UpdateOidc()

in dex/oidc.go [52:80]


func UpdateOidc(clientId string, redirectUris []string, trustedPeers []string, name string, logoUrl string) error {
	conn, err := newGrpcConnection()
	if err != nil {
		return getApiClientError(err)
	}
	defer conn.Close()

	client := api.NewDexClient(conn)

	req := &api.UpdateClientReq{
		Id:           clientId,
		RedirectUris: redirectUris,
		TrustedPeers: trustedPeers,
		Name:         name,
		LogoUrl:      logoUrl,
	}

	if resp, err := client.UpdateClient(context.TODO(), req); err != nil || (resp != nil && resp.NotFound) {
		if resp != nil && resp.NotFound {
			err = fmt.Errorf("oauth client %s not found", clientId)
			return getError(err)
		}

		err = fmt.Errorf("failed to update oauth client %s", err)
		return getError(err)
	}

	return nil
}