Quick update, my counters were wrong. I should have initialized the device with counters set to 0.
Now I have:
>>> d = user.yubikeydevice_set.create(
key='000102030405060708090a0b0c0d0e0f', private_id='010203040506', session=0, counter=0)
>>>
d.id3
>>> d.verify_token(b'cccccccedvgtiblfkbgturecfllberrvkinnctnn')
True
So now I set this in my test projects URL conf:
admin = OTPAdminSite(OTPAdminSite.name)
urlpatterns = [
url(r'^admin/', admin.urls),
]
So the admin login now has 3 fields, user, pass and OTP.
And after deleting my device and incrementing my public ID, I fill in my test user and password, and paste in the proper OTP (with ID 'cccccccf' since ID ==4 now) but the login fails.
Weird thing is that when the device dropdown is shown, there are no devices there. Even though I get this:
>>> list(devices_for_user(u))
[<YubikeyDevice: (admin)>]
Thoughts?