Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to authenticate TCP #12

Open
binar1 opened this issue Sep 14, 2021 · 10 comments
Open

unable to authenticate TCP #12

binar1 opened this issue Sep 14, 2021 · 10 comments

Comments

@binar1
Copy link

binar1 commented Sep 14, 2021

Hi ,
I faced an issue while using this library with iface 1000 zk device ,It will return panic: unauthorized
Heres My code:

func ZkRun() {
	zkSocket := gozk.NewZK("10.20.0.7", 4370, 0, gozk.DefaultTimezone)
	if err := zkSocket.Connect(); err != nil {
		panic(err)
	}

	c, err := zkSocket.LiveCapture()
	if err != nil {
		panic(err)
	}

	go func() {
		for event := range c {
			log.Println(event)
		}
	}()

	gracefulQuit(zkSocket.StopCapture)
}

func gracefulQuit(f func()) {
	sigChan := make(chan os.Signal)
	signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
	go func() {
		<-sigChan

		log.Println("Stopping...")
		f()

		time.Sleep(time.Second * 1)
		os.Exit(1)
	}()

	for {
		time.Sleep(10 * time.Second) 
	}
}

but when i am testing with pyzk library every thing is fine

@canhlinh
Copy link
Owner

@binar1 Is your device has password ?

@binar1
Copy link
Author

binar1 commented Sep 15, 2021

@canhlinh No, password was not assigned

@dfsRony
Copy link

dfsRony commented Sep 17, 2021

I also face this issue right now, any suggestion how to resolve this?

@canhlinh
Copy link
Owner

I'll check it when have time.

@yusrenaltair
Copy link

Any update on this?
I've trying for ZKTeco Uface202 Plus; some devices can be connected; some more are having this problem.

@canhlinh
Copy link
Owner

@young-altair I can not check this issue due to the lack of test devices. =))

@yusrenaltair
Copy link

@young-altair I can not check this issue due to the lack of test devices. =))
As it turned out, I only needed to delete row number 77

gozk/zk.go

Line 77 in e7857c1

if res.Code == CMD_ACK_UNAUTH {

to line 87

gozk/zk.go

Line 87 in e7857c1

}

and now it works!

@canhlinh
Copy link
Owner

@young-altair Got cha. but without test devices. I can not make a decision. Because this code till works with my device

@ahmedibra28
Copy link

I'm also having the same issue: "unauthorized."
My device is ZKTeco U270

@canhlinh
Copy link
Owner

@ahmedibra28 Could you test with this lib https://github.com/fananimi/pyzk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants